Hi,
I'm trying to build a calendar app for work.
The calendar works with the days of the week as rows, and the various departments' as columns. Only one entry is needed per dept. per day.
Presently my database setup is a table for each department, with 'date' (in the format 2006-06-06) and 'activity' as the fields.
My first attempt had a loop of the days of the week, within which was a loop with a mysql_query for each dept. This of course is very (very) inefficient.
What I want is a query that can get all records from all tables (or selected tables, but that's for later) that have a specific date. I think that if possible, a date range would be best, but I'm not sure if this is possible.
I've tried this unsuccessfull:
$sql = "SELECT * FROM
table1, table2, table3, table4, table5
WHERE table1.date_id = '2007-06-06'
OR table2.date_id = '2007-06-06'
OR table3.date_id = '2007-06-06'
OR table4.date_id = '2007-06-06'
OR table5.date_id = '2007-06-06' ";
This produced no record sets (even though the data existed) so I know that the query is incorrect.
Can anyone help?
Thanks,
Mei