How to write Top query | Order by | ascending | descending order in sql server 2005-2008.
SELECT TOP (1) cl_id, cl_name, cl_lst_name, cl_phone, cl_sal
FROM clnt_tb
ORDER BY cl_lst_name DESC
or
SELECT TOP (1) * from clnt_tb order by cl_lst_name desc
SELECT TOP (2) * from clnt_tb order by cl_lst_name descSELECT TOP (1) cl_id, cl_name, cl_lst_name, cl_phone, cl_sal
FROM clnt_tb
ORDER BY cl_lst_name DESC
or
SELECT TOP (1) * from clnt_tb order by cl_lst_name desc
1 | ram | singh | 898979999 | 10000 | ||
NULL | NULL | NULL | NULL | NULL |
or
ELECT TOP (2) cl_id, cl_name, cl_lst_name, cl_phone, cl_sal
FROM clnt_tb
ORDER BY cl_lst_name DESC
1 | ram | singh | 898979999 | 10000 |
3 | ramayan | rahi | 443434343 | 12345 |
0 comments: