Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 7129

retrieve many child records IF one of them matches query

$
0
0

I have the following select:

SELECT Toxpat.Casenumber, Toxpat.StartDate, Toxexpsub.Subdesc, ToxExpsub.Poisendexcode

from ToxExpsub, Toxpat

inner join

on

(codevalue.CodeID=toxpat.calltype)

where ToxExpSub.SubPoisindexCode=6931087andToxPat.CaseNumber=ToxExpSub.CaseNumber

 My problem is that there are more than one record in Toxexpsub where casenumber = toxpat.casenumber.  how can I get all records in Toxexpsub for toxexpsub.casenumber = toxpat.casenumber IF one of them has Poisendexcode = 6931087


Raul Rego


Viewing all articles
Browse latest Browse all 7129

Trending Articles