Quote:
Originally Posted by hattori.hanzo
I have a mysql database with a few tables. I need to run queries by date (24 hour period) on more than 1 table. How do people usually set this up in the backend.
|
If you extract the same data from all tables, you can use a union:
Code:
SELECT start_date FROM table1 UNION
SELECT start_date FROM table2 UNION
SELECT start_date FROM table3
ORDER BY blah
Which give you a number of rows consisting of one column start_date.
Quote:
Originally Posted by hattori.hanzo
Is it possible to query more than 1 table at a time using a wildcard character for the table name? for example all tables which start with 2006-*.
|
No
Quote:
Originally Posted by hattori.hanzo
I read somewhere that it would be better to setup views.
|
A view is a sort of predefined query. But you can treat it as a table, that is, once you execute a query you get a table with results. In a view you can select from that table.
Quote:
Originally Posted by hattori.hanzo
Would it be possible to setup a view for each 'day' extracting date from the timestamp field then I just run the query on that day's view?
thanks
|
It is unclear what you mean here. But you can run a query on a view.
jlinkels