Hi, On Fri, Aug 01, 2003 at 11:55:36PM +0800, Jaime Teng wrote: > 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. >
You can use a UNION to do this, but you need MySQL 4.x. It won't work in 3.23.x or before. Look in the manual for details. > any suggestion? I read about using JOIN but I have no idea how to\ > make it work for my need. > Joins are used for combining records from multiple tables, which is not what you seem to want to do. Regards, Fred. -- Fred van Engen XB Networks B.V. email: [EMAIL PROTECTED] Televisieweg 2 tel: +31 36 5462400 1322 AC Almere fax: +31 36 5462424 The Netherlands -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]