What would be the best way to combine the two SQL statements into one?
SELECT MIN(capacity) AS mincapacity, MAX(capacity) AS maxcapacity
FROM room
SELECT MIN(grade) AS mingrade, MAX(grade) AS maxgrade
FROM room_grade
Thanks in advance!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The main benefits here are having all the records on one row, and not joining the component records of each table.
Answer that involve a join before the aggregation will introduce a significant overhead that will make a massive difference to performance.