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
Nepethya Rana
NA
335
151.9k
SQL Query Error while using Group by clause
Jun 19 2017 2:12 PM
What i am trying to achieve is that i want result set returned in two groups for two username with latest data
SELECT TOP(100) id , insertdate, modifieddate, detail, username FROM MyTable
WHERE username = 'AAA' or username='1234'
GROUP BY username
ORDER BY insertdate DESC
But when i run this query i get error :
Column 'MyTable.id' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
How do i achieve this?
Reply
Answers (
3
)
Connection String Problem
MVC CRUD in Single Page