On Wed, 2005-08-03 at 11:59 +0100, James M. Gonzalez wrote: > > I would like to obtain the following results: > > > > CompanyName - WhatToShip - Ready - Almost - Done > > Foo - car - 26 - 2 - > 23 > > Foo - elephant - 43 - 0 - 15 > > Foo - acuarium - 12 - 6 - 47 > > Bar - mobile - 9 - 0 - > 52 > > Bar - fan - 15 - 4 - > 43 > > select
SELECT sum(if(tracking_number = '' AND serialNumber = ''),1,0) as ready ,sum(if(tracking_number != '' AND serialNumber = ''),1,0) as almost from etc I havent specifically tested this but thats the general idea, it's called cross tabulation. if you google cross tabulation tutorial i'm sure something will come up tony -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]