SELECT [field list] FROM archivetable,currenttable WHERE archivetable.username=currenttable.username


notes: can use join,left,right,select inside select aka subselect check the manual for detail

Regards,
--
Aftab Jahan Subedar
Software Engineer
Subedar Technologies
Subedar Baag
Bibir Bagicha #1
81/1-A North Jatrbari
Dhaka 1204
Bangladesh
sms://+447765341890
sms://+880171859159
http://www.ceobangladesh.com
http://www.DhakaStockExchangeGame.com
http://www.geocities.com/jahan.geo

Fred van Engen wrote:
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.


Regards, -- Aftab Jahan Subedar Software Engineer Subedar Technologies Subedar Baag Bibir Bagicha #1 81/1-A North Jatrbari Dhaka 1204 Bangladesh sms://+447765341890 sms://+880171859159 http://www.ceobangladesh.com http://www.DhakaStockExchangeGame.com http://www.geocities.com/jahan.geo



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



Reply via email to