开发者

SQL Query to get first two highest column values from a table

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜