Jump to content


Photo

how to access "GROUP BY" items?


  • Please log in to reply
3 replies to this topic

#1 michaellunsford

michaellunsford
  • Members
  • PipPipPip
  • Advanced Member
  • 1,023 posts
  • LocationLouisiana, USA

Posted 10 September 2006 - 05:01 PM

if I use the GROUP BY command, it returns the first record in each group -- can I dig deeper and get all of the records?

#2 extrovertive

extrovertive
  • Members
  • PipPipPip
  • Advanced Member
  • 235 posts

Posted 10 September 2006 - 06:19 PM

If you want to get all the record, why use group? GROUP is maily use for aggregrating stuff, like MAX, MIN, COUNT, etc.

#3 michaellunsford

michaellunsford
  • Members
  • PipPipPip
  • Advanced Member
  • 1,023 posts
  • LocationLouisiana, USA

Posted 10 September 2006 - 08:12 PM

Yeah, I guess I need a second query.

#4 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 10 September 2006 - 09:13 PM

Any time you use an aggregate function, you "lose" all information about the non-grouped by columns, and you get an arbitrary one back.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users