RE: [PHP] MySQL problem

From: Date: Wed, 04 Jul 2001 23:28:24 +0000
Subject: RE: [PHP] MySQL problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-56238@lists.php.net to get a copy of this message
Sorry!!! I'm stupid! I forgot to mention that the list of causes has to be for a specified accident_report.weekending Cheers Simon > -----Original Message----- > From: Don Read [mailto:dread@texas.net] > Sent: 04 July 2001 23:21 > To: Simon Kimber > Cc: php-general@lists.php.net > Subject: RE: [PHP] MySQL problem > > > > On 04-Jul-01 Simon Kimber wrote: > > Hi All, > > > > Does anyone know if this can be done with one query? > > > > I have to create a chart based on info in two tables that are > four tables > > apart. > > > > Here are the relevant tables and just the most relevant fields... > > > > accident_report > > - ID > > - weekending (this is a YYYY-MM-DD format date) > > - (and others) > > > > accident_data > > - ID > > - accident_report_id > > - (and others) > > > > accident_cause (a lookup table) > > - ID > > - accident_data_id > > - cause_id > > > > cause (a list of possible causes of accidents ie. "falling object" or > > "electric shock" > > - ID > > - Description > > > > > > I need to list all the causes with the number of times each has > occurred, > > even if it's zero times... they don't need to be listed in any > particular > > order... > > > > "select cause.ID, count(*) as cnt from ... > WHERE ... > group by cause.ID"; > > Regards, > -- > Don Read dread@texas.net > -- It's always darkest before the dawn. So if you are going to > steal the neighbor's newspaper, that's the time to do it. >

« previous php.general (#56238) next »