RE: [PHP] PHP/mySQL question about groups
| From: | Bastien Koert | Date: | Thu, 07 Feb 2008 03:16:28 +0000 |
| Subject: | RE: [PHP] PHP/mySQL question about groups | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-268828@lists.php.net to get a copy of this message | ||
Select * from wine where name = 'Silver Oak' GROUP BY wineid,size
bastien> Date: Wed, 6 Feb 2008 17:46:52 -0800> From: gouldimg@mac.com> To:
bastien> php-general@lists.php.net> Subject: [PHP] PHP/mySQL question about groups> > Let's say
bastien> I have a PHP-based wine application, and it's taking a set of mySQL data that looks like
bastien> this:> > wineid name size > 123 Silver Oak 750ML> 123 Silver Oak 1.5L> 123 Silver Oak
bastien> 1.5L> 456 Liberty School 750ML> 456 Liberty School 750ML> 456 Liberty School 750ML> 456
bastien> Liberty School 1.5L> > > If I do a:> > Select * from wine where name = 'Silver
bastien> Oak' GROUP BY 'wineid'> > I'd get:> > Silver Oak> > >
bastien> However, what I'd REALLY like to return is:> > Silver Oak 750ML> Silver Oak 1.5L>
bastien> > I'd like the groupby to group by wineid, BUT ALSO separate the groups by 'size'.
bastien> So there'd be a '750ML' group, and a '1.5L' group> > Can anyone tell
bastien> me how I'd do that? I'm hoping I don't have to write a PHP script that loops through
bastien> the results and separates things manually.> > -- > PHP General Mailing List
bastien> (http://www.php.net/)> To unsubscribe, visit:
bastien> http://www.php.net/unsub.php>
_________________________________________________________________