SQL query Help! - Sajha Mobile
SAJHA MOBILE
SQL query Help!
Posts 4 · Viewed 6907 · Go to Last Post
chinday
· Snapshot 0
Like · Likedby · 0
Can you please help me get sql query for below output from the input provided :

TABLE:

No of classes Student
Science A
Commerce A
Science B
Science C
Commerce C
Commerce C
Science B
Science A
Science G
Commerce D
Commerce D
OUTPUT:

No of classes Student Count
Science A 2
Commerce A 1
Science B 2
Science C 1
Commerce C 2
Commerce D 2
Science G 1

I will appreciate the help.

nepalinaike
· Snapshot 13
Like · Liked by · 0
You might want to try something like this:

select number of classes, student, count(*) as Count
From tablename
group by number of classes, student

Good luck!
Lee_St
· Snapshot 119
Like · Liked by · 0
SELECT NO OF CLASSES,STUDENT,COUNT(*) AS COUNT
FROM TABLE
GROUP BY NO OF CLASSES,STUDENT
ORDER BY STUDENT ASC;
STUPIDA
· Snapshot 157
Like · Liked by · 0
SELECT [No of classes], Student, COUNT(*) AS Count
FROM TABLE
GROUP BY [No of classes], Student
ORDER BY Student ASC, [No of classes] DESC;
Please log in to reply to this post

You can also log in using your Facebook
View in Desktop
What people are reading
You might like these other discussions...
· Posts 1 · Viewed 87
· Posts 2 · Viewed 266
· Posts 1 · Viewed 169
· Posts 24 · Viewed 7447 · Likes 2
· Posts 26 · Viewed 2284 · Likes 5
· Posts 1 · Viewed 84
· Posts 1 · Viewed 105
· Posts 1 · Viewed 190
· Posts 2 · Viewed 293
· Posts 13 · Viewed 3455 · Likes 6



Your Banner Here
Travel Partners
Travel House Nepal