Hello Everyone,
Can anyone know how to use order by without use of group by ?
Problem :
I have some of col in my sql query of select like where i also used some aggregate functions now i want to use one col EntryDate from my table but didn't want to use that in group by.
Example:
- SELECT ID, CONVERT(VARCHAR(15), EntryDate, 101) AS Entry_Date , NAME, SUM(PRICE) FROm MYTABLE WITH ( NOLOCK ) GROUP BY ID, NAME, CONVERT(VARCHAR(15), EntryDate, 101)
- SELECT ID, CONVERT(VARCHAR(15), EntryDate, 101) AS Entry_Date , NAME, SUM(PRICE) FROm MYTABLE WITH ( NOLOCK ) GROUP BY ID, NAME, CONVERT(VARCHAR(15), EntryDate, 101)
- ORDER BY EntryDate

Nitin SontakkePosted Jul 26, 2018, 6:41 AM
Nikunj SatasiyaPosted Jul 26, 2018, 7:41 AM
Nitin SontakkePosted Jul 26, 2018, 7:01 AM
Nikunj SatasiyaPosted Jul 26, 2018, 6:48 AM
Nikunj SatasiyaPosted Jul 26, 2018, 6:43 AM
Nitin SontakkePosted Jul 26, 2018, 6:37 AM
Nitin SontakkePosted Jul 26, 2018, 5:48 AM
Nikunj SatasiyaPosted Jul 26, 2018, 4:42 AM
Nitin SontakkePosted Jul 26, 2018, 4:36 AM
Jenith ThakkarPosted Jul 26, 2018, 4:29 AM
if yes then you can try partition over by for that Like this
I hope it will helpful for you