Click here to Skip to main content
15,885,767 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Below is my query. Now i need to order lupname in ascending order. Where can i put ORDER BY in the below query

SQL
select t1.date as DATE, t1.lupname as LUBNAME,t1.closingstock as STOCK from lub t1 INNER JOIN( select lupname, MAX(DATE) DATE from
    lub GROUP BY lupname) t2 ON t1.lupname=t2.lupname AND t1.date=t2.date

Thanks
Siva
Posted

1 solution

At the end...
SQL
select 
	t1.date as date, 
	t1.lupname as lubname,
	t1.closingstock as stock 
from lub t1 
	inner join( select lupname, max(date) date from lub group by lupname) t2 on t1.lupname=t2.lupname and t1.date=t2.date
order by
	t1.lupname
 
Share this answer
 
Comments
sivamzcet 2-Jan-14 7:09am    
i got thru order by id..
Anyway thanks fr ur help

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900