OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: MySQL SELECT Statement with Date help request

From: Brent Baisley (brenttechgmail.com)
Date: Wed Jan 09 2008 - 18:37:31 CST


Sounds like you should create a MERGE table that links all the
underlying tables together. Then you just query the merge table and
MySQL handles which tables it needs to pull data from. You also then
don't need to query for the tables.

On Jan 9, 2008, at 9:12 AM, Cx Cx wrote:

> Hi List,
>
> I am wondering if someone can help me with a query to check what
> databases
> are on the MySQL server and then check which of those databases are
> either
> partially or completely within the date range i require.
>
> The scenario is as follows:
>
> db1 : 2007-01-01 to 2007-02-01
> db2 : 2007-02-01 to 2007-03-01
> db3 : 2007-03-01 to 2007-04-01
> db4 : 2007-04-01 to 2007-05-01
> db5 : 2007-05-01 to 2007-06-01
> db6 : 2007-06-01 to 2007-07-01
>
> I require a select statement to query all the db's to identify
> records with
> the date range for eg. 2007-02-15 to 2007-05-12.
>
> Logically this tells me that the databases that will have this
> information
> will be db2,db3,db4 and db5.
>
> My problem is that i have multiple servers running at different
> locations
> that uses the same app that writes to the MySQL db. However the
> amount of
> databases on each server differs in amount of db's and date ranges
> for each
> server.
>
> Is there a way of getting such a result with MySQL?
>
> Thanks in advance,
>
> Craig

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql