

CodePudding user response:
create table # a
(
Studentno char (11),
Sname varchar (8),
Sex varchar (4),
Birthday date
)
Insert into # a
Select '18122210009', 'Xu Dongshan' and 'male', '1999-11-05' union all
Select '18122221324', 'what the millennium', 'female' and '2000-12-04 s' union all
Select '18125121107', 'worship hengjiang' and 'male', '2000-03-01' union all
Select '18125121107', 'liang a reed', 'female' and '1999-09-03 s' union all
Select '19120000111', 'Korea mountains and rivers' and' male ', '2000-02-05'
Select the top 1 datediff (year, birthday, getdate ()) as the maximum age, *
The from # a
Where sex='male'
The order by the maximum age desc

I am using is essentially, results and you don't know how, but I'm not an error
CodePudding user response:
Or an error, alas, I this is used alone any conditions can, as long as two at the same time with errorsCodePudding user response: