I want to have a query in my sql which will r开发者_StackOverflow中文版eturn the result as -
I am having a table named employee with columns name,salary,address. The query should return the first two highest column values from the employee table.
This should be single query.
If the highest column is salary
, you do this:
select salary from employee
order by salary desc
limit 2
You would do the same for any other columns, just replace the column name in the SELECT
and in the ORDER BY
sections.
精彩评论