Select the difference between the maximum and minimum weight of a person with the last name Maroni.
P粉564301782
P粉564301782 2024-03-28 12:25:10
0
1
369

SELECT weight AS weight_delta
from (select max(weight) 
      from patients 
      where last_name='Maroni')
      -
      (select min(weight) 
      from patients 
      where last_name='Maroni');

P粉564301782
P粉564301782

reply all(1)
P粉639667504

You are thinking too complicatedly. Find the difference without any subquery:

SELECT MAX(weight) - MIN(weight) AS weight_delta 
FROM patients WHERE last_name = 'Maroni';
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!