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
 Transact-SQL (2000)
 How to see these records One or More than One

Author  Topic 

wshtrue
Yak Posting Veteran

74 Posts

Posted - 2005-06-28 : 21:15:32
Hello,
Can anyone help me with this problem.OK!i need to see 3 results, One only Applnumber and no PatientInfo.
Table
ApplNumber PatientInfo
001
001
001
When i put 001 in the search column of GUI it should return only one record with ApplNumber 001 and not 3 records.
Right now i gave you just an example.I have no clue which Applnumbers are there where PatientInfo is Null
Second Query i need that i should get ApplNumber with one medicine only which will show under Patientinfo for an example
It would be
Table
ApplNumber PatientInfo
001
001 05
What query should i give that i just get two records with ApplNumber 001
Result should be
Table
ApplNumber PatientInfo
001
001 05

My GUI needs to show me only records where patientInfo is 05. It will not show any records where there is only ApplNumber but no PatientInfo

My third Query is
Table
ApplNumber PatientInfo
001
001 05
001 07
Now i need to see more than one record with the same ApplNumber so My GUI needs to show me records where patientInfo is 05 & 07. It will not show any records where there is only ApplNumber but no PatientInfo
I hope i was clear.
Please do not use these field values. I want queries without these values.If i know these values then i can write queries myself. Imagine we do not know the values. Thank you in advance

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2005-06-28 : 22:18:40
[code]select distinct applnumber, patientinfo from Tablet[/code]

--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"
Go to Top of Page
   

- Advertisement -