Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: "Bob Barrows" Newsgroups: comp.databases.ms-sqlserver Subject: Re: conditional query Date: Tue, 23 Aug 2011 14:11:51 -0400 Organization: A noiseless patient Spider Lines: 28 Message-ID: References: <6d06d2ab-012b-4e50-a734-9c71a7dc31c6@s7g2000yqd.googlegroups.com> Injection-Date: Tue, 23 Aug 2011 18:12:59 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="NUmboHSNYG4cX5Ys9j8TNw"; logging-data="11501"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/lIS7nqHgcMG5uxZsbODHY+UOA05EbPA8=" X-Newsreader: Microsoft Outlook Express 6.00.2800.2001 Cancel-Lock: sha1:PBi4C71Hm+V1oALYUYzd5YrCWo0= X-Priority: 3 X-MSMail-Priority: Normal X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.2001 Xref: x330-a1.tempe.blueboxinc.net comp.databases.ms-sqlserver:618 Harry wrote: > I have a table with three columns: > > Name Date Action > Fred Today this > Fred Today this > Fred Today that > Wilma Today this > > > I want to sort by name and by date, but only if 'this' was done more > than once on the same day, and not if 'that' was done on the same > day,They have to perform this more than once, and they cannot have > performed that on the same day. > > So the desired result from this sample data would be an empty resultset? What do you want to display when the data actually contains rows that meet your requirement? All the rows for that name and date? Or a single row for that name and date? Why don't you try again. Show us some sample data that includes data that meets your requirements and then show us what you want the desired query to return. The key being "show" - don't just describe the desired result: show it to us.