home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 18,428 of 19,505   
   Bob Barrows to Yonghang Wang   
   Re: conditional query   
   24 Aug 11 17:34:46   
   
   ooglegroups.com> 103bd98b   
   From: reb01501@NOSPAMyahoo.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.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca