Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validate data in table is from list in another table 1

Status
Not open for further replies.

jpkeller55

Technical User
Apr 11, 2003
131
0
0
US
I have data in two tables as listed.

CatheterTypes: Lists approved descriptions of catheters
ID Description
1 PIV
2 Hickman
3 Groshong


PatientData: Contains data on patients including catheter type

ID Name CathType
123454 Jones, John PIV
245678 Smith, Sue Peripheral
387542 Ford, Fred Hickman
654783 Tuttle, Tim Port
876494 Baker, Bob Groshong

I would like to write a query that will look at the value of CathType in PatientData and compare it to the descriptions in the CatheterTypes table.
The query would return records that do not have an approved cather description as in the example below:

ID Name CathType
245678 Smith, Sue Peripheral
654783 Tuttle, Tim Port

I am sure this is a simple thing, but I have no clue. Thanks, JK
 
select *
from PatientData
left join CatheterTypes
on PatientData.CathType = CatheterTypes.CathType
where CatheterTypes.CathType is null
 
Thanks pwise...this does the trick perfectly!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top