* Jaime Teng
[...]
> Now, I have two of these tables (archivetable,currenttable).
>
> My problem is how do I perform a single query such that I get
> results from these two tables:
>
> mysql> select * from archivetable,currenttable;
> +------------+------------+---------------------+---------------------+
> | sessionid  | username   | logon               | logoff              |
> +------------+------------+---------------------+---------------------+
> | 0000000003 | dangco77   | 1996-09-25 20:51:59 | 1996-09-25 21:07:00 |
> | 0000000006 | mccarthy   | 1996-09-26 06:15:35 | 1996-09-26 06:20:00 |
> | 0000000007 | sigmaph    | 1996-09-26 06:25:48 | 1996-09-26 06:28:00 |
> | 0000000009 | sigmaph    | 1996-09-26 08:31:53 | 1996-09-26 08:51:00 |
> | 1000265891 | okame      | 2003-08-01 13:38:24 | 2003-08-01 13:43:42 |
> | 1000265893 | kbs        | 2003-08-01 13:38:30 | 2003-08-01 13:38:48 |
> | 1000265897 | bdo-albaro | 2003-08-01 13:38:54 | 2003-08-01 14:07:06 |
> +------------+------------+---------------------+---------------------+
>
> of course that last query isnt correct but thats the result I want.
>
> any suggestion? I read about using JOIN but I have no idea how to\
> make it work for my need.

Like Fred said, UNION if you use 4.x, but if you use 3.23.x, you could use
the MERGE tables option:

<URL: http://www.mysql.com/doc/en/MERGE.html >

You basically create a 'wrapper' table around your existing two (or more)
identically strucured tables, and can query them all in a single SELECT like
if it was a single table.

--
Roger


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to