roberto.bazan@stripped wrote:
>
> Can anybody help me please?
> I have a database with 2 tables: table1, table2,
>
> the table1 has the same structure as table2:
>
> date and User
>
> my idea, is get all users between for example 1999-11-23 and 1999-12-23
>
> all days of month 11 are into table1 and all days of month 12 are into
> table2
> When i try run then next query:
>
> select t1.User,t2.User table1 as t1, table2 as t2 where
> (t1.Fecha>'1999-11-29' &&
> t2.Fecha<'1999-12-23')
>
> Then is running but don't work,
>
> How can i create the sql sentence for do this ?
You want a UNION of the 2 tables rather than a JOIN. MySQL doesn't
directly support UNIONs, but you can emulate one with a temporary table:
CREATE a table with the one field User
INSERT INTO tmp_table SELECT User FROM table1 WHERE Fecha > '1999-11-23
23:59:59'
INSERT INTO tmp_table SELECT User FROM table2 WHERE Fecha < '1999-12-23
00:00:00'
SELECT * FROM tmp_table
DROP tmp_table
jim...