I've a table like this:
+----+------+--------+
| id | name | salary |
+----+------+--------+
| 1 | Ajay | 20000 |
| 2 | Aja | 2000 |
| 3 | Aj | 200 |
| 4 | A | 3000 |
| 5 | q | 30000 |
+----+------+--------+
I want to write a query that can print highest salary, medium salary and lowest salary. So I wrote this query:
select salary
from parent
where max(sal)
&& salary < ( SELECT MAX( salary )
FROM parent )
&& min(salary);
And mysql returned an error:
ERROR 1111 (HY000): Invalid use of group function
what is the correct query?