Forum Moderators: coopster

Message Too Old, No Replies

mysql - joining two tables

really so simple?

         

macdar

4:49 pm on Mar 13, 2005 (gmt 0)

10+ Year Member



Hi all,
I've got 2 tables with an identical structure, but with different entries (products).

Let's say, table1 contains:
product A
product C
product E

table2 contains:
product B
product D
product F

I need to select all products and sort the alphabetically.
product A
product B
product C
etc...

I assume if would have to join those two tables somehow. I've taken a look at a "JOIN" statement, but it requires putting WHERE. I also can not export table1 one into table2 cause, they have some id's which can not be duplicated..

Any thoughts?
Thanks.

coopster

5:52 pm on Mar 13, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



There are a few different ways to accomplish this, but the easiest is probably a UNION JOIN. If the results need to be unique, add a DISTINCT keyword.

Similar discussion ...

[webmasterworld.com...]