TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Nikunj Satasiya
183
10k
3.6m
How to Use Order BY Without Group By in Sql Server
Jul 26 2018 4:25 AM
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)
But I Want Something like this without use Group By
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
Can Anyone Help me Please ?
Reply
Answers (
10
)
Unable to Connect SSMS to Godaddy DB from my local system
Fill missing value