Home > database >  The select statement how to write
The select statement how to write

Time:09-15

One's deceased father grind the inside of the exercises, and torture me for a week, I just want to solve with two views, can't think out a little bit more simple said method, circle number 6

CodePudding user response:

Nobody reason I??

CodePudding user response:

 SELECT sname 
The FROM student
WHERE sno=(
SELECT sno
The FROM student_project
GROUP BY sno
HAVING a COUNT (sno)=(
SELECT the TOP 1 COUNT (sno) as times
The FROM student_project
GROUP BY sno
The ORDER BY times DESC
)
)

CodePudding user response:

refer to the second floor of the fork - you reply:
 SELECT sname 
The FROM student
WHERE sno=(
SELECT sno
The FROM student_project
GROUP BY sno
HAVING a COUNT (sno)=(
SELECT the TOP 1 COUNT (sno) as times
The FROM student_project
GROUP BY sno
The ORDER BY times DESC
)
)
understand thank you, I am the one's deceased father grind, only to learn the teaching material, the order by later said don't know how to take out the first value, the book did not speak, thank you

CodePudding user response:

refer to the second floor of the fork - you reply:
 SELECT sname 
The FROM student
WHERE sno=(
SELECT sno
The FROM student_project
GROUP BY sno
HAVING a COUNT (sno)=(
SELECT the TOP 1 COUNT (sno) as times
The FROM student_project
GROUP BY sno
The ORDER BY times DESC
)
)
hello, I want to ask, the subquery can't use the order by statement?
  • Related