Reply
mysql GROUP BY 2 fields at the same time?
Old 01-29-2009, 09:32 AM mysql GROUP BY 2 fields at the same time?
Skilled Talker

Posts: 67
Trades: 0
Hi,

Can i use the GROUP BY function in a mysql query to group by 2 fields at the same time? So not group by x, then by y, but group by x and y at the same time?

thanks!

Matt
killerwhale65 is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 01-29-2009, 09:43 AM Re: mysql GROUP BY 2 fields at the same time?
chrishirst's Avatar
Super Moderator

Posts: 26,421
Location: Blackpool. UK
Trades: 0
group by field, field
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | Crowded Nightclub? | Bits & Bobs
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-29-2009, 09:43 AM Re: mysql GROUP BY 2 fields at the same time?
tripy's Avatar
Do not try this at home!

Posts: 3,422
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
of course
Code:
select x,y
from z
group by x,y
Just remember that you must output only the fields you want to group
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is online now
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Reply     « Reply to mysql GROUP BY 2 fields at the same time?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.09212 seconds with 13 queries