hai i have a table where student enter accordingly to their category and instituteid wise .
i want to see the student report to their category and instituteid wise how to make a query.........
i ran the follow query.........
SELECT Category, COUNT( StudentID ) AS Sum
FROM studentregdtb
GROUP BY Category
LIMIT 0 , 30
its gives only category wise student sum record.....but how to get in institutewise also..........
thanks
how to use group by in two ield in mysql
Moderator: General Moderators
-
manojsemwal1
- Forum Contributor
- Posts: 217
- Joined: Mon Jun 29, 2009 4:13 am
- Location: India
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: how to use group by in two ield in mysql
Add instituteid to the GROUP BY. See the docs.
(#10850)
Re: how to use group by in two ield in mysql
Try this
Code: Select all
SELECT InstituteId, Category, COUNT( StudentID ) AS Sum
FROM studentregdtb
GROUP BY InstituteId,Category
LIMIT 0 , 30