Quantcast
Channel: Getting started with SQL Server forum
Viewing all articles
Browse latest Browse all 9243

sqlquery to get all cases in a child table

$
0
0

I have to tables - demographics and PatSubs.  Both tables are linked by caseno filed.

Now, PatSubs may have one or many substance entry for the caseno.

If I do the following:

USE [njpies2013]

GO

SELECT [CaseNumber]

     ,[CenterCode]

     ,[YearCode]

      ,[SubVerbatim]

     

 FROM [dbo].[ToxExpSub]

   where SubPoisindexCode = 6931087

GO

I will only get the cases in PatSub that match =693107; however what I want is if there's a record with PoisendexCode 6931087 than give me all the entries in PatSub for THAT caseno

Please help me with this query,

Thanks

Raul


Raul Rego


Viewing all articles
Browse latest Browse all 9243

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>