Please help, I want to do a select query selecting the ID (from table 1) for where the person is under 18 and if there has been an episode (table 2) done on the person in the last 12 months (ie. Start date). The problem I¡¯m having is that there may be more than one episode that has been done. I think I need a query something like this
Select t1.id from table1 t1
Where
Exists(select * from table2 t2
Where t2.start_date> dateadd(m,-12,getdate())
And
T1.dob>getdate()
Table 1
People DOB
ID
100 23/2/1980
101 12/12/1968
102 1/1/2000
103 12/12/2003
Table 2
Episode People Start_Date
45 100 30/01/2003
46 100 12/01/2007
47 101 01/01/2002
48 103 19/2/2007
Result
People ID
100
103