MySQL problem
| From: | Simon Kimber | Date: | Wed, 04 Jul 2001 22:00:21 +0000 |
| Subject: | MySQL problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-56233@lists.php.net to get a copy of this message | ||
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...
Cheers
Simon Kimber