assuming that each table only has one element, you could do a select * from
2 table.
If you don't and you need to combine everything, then you're trying to do a
UNION.
mySQL doesn't support UNION's yet.
one way to do a union is to create a temporary table then use two queries to
fill the
temporary table. if you need the data on a more permenant basis, then you
won't create
a temporay table. the problem might be for the data to be constantly
updated.
you could schedule a cron job (UNIX) or write a script and schedule it with
Task Scheduler (NT,2000)
create table everything
(
animalname varchar(25)
);
insert into everything values (animalname)
select animalname from table1;
insert into everything values (animalname)
select animalname from table2;
-----Original Message-----
From: Mike Mike [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 26, 2001 11:05 AM
To: [EMAIL PROTECTED]
Subject: Selecting * from 2 tables
Hello list,
How would you go about selecting * from 2 tables?
I have 2 tables: table_1 and table_2
In table_1 I have the following data.
dog
bird
cat
In table_2 I have:
mouse
rat
hampster
How do I show both tables contents like:
+----------+
|dog |
|bird |
|cat |
|mouse |
|rat |
|hampster |
+----------+
I've tried the following but its not producing what I
need.
select * from table_1,table_2;
select * from table_1 where ID IN (select ID from
table_2);
select * from table_1 UNION select * from table_2;
Any help would be great
Thanks for your help
--Mike
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices.
http://auctions.yahoo.com/
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php