Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.ms-sqlserver > #625
| From | "Bob Barrows" <reb01501@NOSPAMyahoo.com> |
|---|---|
| Newsgroups | comp.databases.ms-sqlserver |
| Subject | Re: conditional query |
| Date | 2011-08-24 17:34 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <j33r3i$nfp$1@dont-email.me> (permalink) |
| References | <6d06d2ab-012b-4e50-a734-9c71a7dc31c6@s7g2000yqd.googlegroups.com> <j30qjb$b7d$1@dont-email.me> <9d3c54c1-361f-41be-92cc-be2c95afa66b@p10g2000yqi.googlegroups.com> <966b76c5-6b95-4c98-a593-cc4d433a2803@glegroupsg2000goo.googlegroups.com> |
Yonghang Wang wrote: > select * from t1 > where > proc = 'stent' > and (name, date) in > ( > select name,date from t1 > group by name,date > having count(distinct proc) = 1 > ) That will "work" with this set of data, but fail if the data contains a single row for a patient for a date. The requirement is to only return rows where a patient has multiple stents on a single day, and where he also has an unstent on the same day.
Back to comp.databases.ms-sqlserver | Previous | Next — Previous in thread | Next in thread | Find similar
conditional query Harry <hamackey@gmail.com> - 2011-08-23 06:49 -0700
Re: conditional query Henk van den Berg <me@myplace.net> - 2011-08-23 19:41 +0200
Re: conditional query Harry <hamackey@gmail.com> - 2011-08-23 10:56 -0700
Re: conditional query Henk van den Berg <me@myplace.net> - 2011-08-23 23:04 +0200
Re: conditional query "Bob Barrows" <reb01501@NOyahooSPAM.com> - 2011-08-23 14:11 -0400
Re: conditional query Harry <hamackey@gmail.com> - 2011-08-23 12:06 -0700
Re: conditional query "Bob Barrows" <reb01501@NOyahooSPAM.com> - 2011-08-23 15:35 -0400
Re: conditional query Yonghang Wang <wyhang@gmail.com> - 2011-08-24 13:53 -0700
Re: conditional query "Bob Barrows" <reb01501@NOSPAMyahoo.com> - 2011-08-24 17:34 -0400
Re: conditional query Yonghang Wang <wyhang@gmail.com> - 2011-08-24 21:21 -0700
csiph-web