This looks pretty simple on the face of it but I can't get my head around it.
I have two tables that I'm querying:
I am trying to find which Respondents who have only sons - one must be aged between 01/09/1998 and 31/08/1999 and another aged between 01/09/1995 and 08/12/1995.
The query I'm using is:
SELECT r.FirstName, r.Surname
from dbo.tblRespondents r
INNER JOIN dbo.tblRespondentsChildren rc
on r.RespondentID = rc.RespondentID
where rc.Dob between ('1998-09-01') and ('1999-08-31')
and rc.Dob between ('1995-09-01') and ('1995-12-08')
and rc.SexID = 1
It's not returning any results which seems odd to me, knowing the data. I think it's failing because it's trying to find ONE child between 2 age ranges whereas it should be finding Respondents who have at least 2 children, one between each age range.