RE: PHP/mySQL question about groups

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux