Hi,

I have a table:

mysql> describe archivetable;
+-----------+----------+------+-----+---------------------+-------+
| Field     | Type     | Null | Key | Default             | Extra |
+-----------+----------+------+-----+---------------------+-------+
| sessionid | char(10) |      | PRI |                     |       |
| username  | char(25) |      | MUL |                     |       |
| logon     | datetime |      | MUL | 0000-00-00 00:00:00 |       |
| logoff    | datetime |      | MUL | 0000-00-00 00:00:00 |       |
+-----------+----------+------+-----+---------------------+-------+

Whenever I do a query, I get results in this format:

mysql> select * from archivetable;
+------------+------------+---------------------+---------------------+
| 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 |
+------------+------------+---------------------+---------------------+

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.

hoping for your help.

Jaime


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

Reply via email to