Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Select Statement -Results need reported if they meet 2 of 4

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-02-14 : 09:30:26
Matt writes "I am writing 4 queries in which I then need to combine the results. Out of these 4 queries if the patient is listed in at least 2 of the queries then I want to see those names...In english: 1. For a date range select patients that had back or flank pain. 2. For a date range select patients that had a temperature = or over 100.4. 3.For a date range select patients that had a mental status of confused or the like. 4.For a date range select patients that had a non normal urine characteristic (Color, etc-stuff you don't want to know)

If any of these patients had 2,3,0r 4 of the 4 on a particular date then chances are good that they had a Urinary Tract Infection.

Can this be done and if so how. Would I need to create a temp table in which results from all 4 queries dumped the results, then run another query that would count patient Id's on a date? As you can tell I am not very good at this but I have managed to write the 4 queries. Thanks"

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-02-14 : 10:02:46
Give ur table structures (only relevent stuff is enough), some sample data and the results u want to get.

If u want to ur Qs to be answered quickly
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page
   

- Advertisement -