Home > database >  Validate query women in 2019 birth two children, one child for girls
Validate query women in 2019 birth two children, one child for girls

Time:09-26

Validate query women bear children for 2, child birth dates to 2019, one for girls, the child times need to output the name, identification number, date of birth, gender, 1 child 1 child birth date


CodePudding user response:

Select the mother's last name, mother's id number, gender, child birth date
The from ZNXXB a
Where children time=1 and gender=female
And the exists (select top 1 1 from ZNXXB where mother id=a. id the mother and child=2 and child birth date between '2019-1-1' and '2019-12-31')

CodePudding user response:

 

Select the mother's last name, mother's id number, gender, child birth date
The from ZNXXB a
Where children time=1
And gender=N 'female'
And mother id in (Select id
The From (select mother id number, Max (child) as child time _count
The from ZNXXB
Where year (children's date of birth)=2019
Group by mother id) a
Where children _count=2)


  • Related