[thelist] Sql join problem
Paul Bennett
Paul.Bennett at eyede.com
Thu Dec 9 13:20:55 CST 2004
or (mysql):
CREATE TABLE tablename AS (YOUR SQL STATEMENT HERE )
bearing in mind that if you have a join with two table which share the
same field names (eg: 'id' is on both tables) you will have to rename
the field for one of them in the sql statement.
eg: select table1.id, table2.id as t2_id from table1 left join table2 on
(conditions here)
or have I just made the issue more foncusing?
Bring Back RUDY!!!
Brian Cummiskey wrote:
>> you mention merging- the only way to do that is by use of a
>> temporary table Depending on the sql server (MS, MySQL, etc) the
>> create statements are different.
>
>
> but basically, you'd:
>
> create table #blah (member_id varchar(50))
>
> then,
>
> insert into #blah
> select member_id from members
>
> insert into #blah
> select member_id from profile
> where member_id not in (select member_id from #blah)
>
>
> then, select * from blah.
>
> HTH
--
Paul Bennett
Web Technologies Developer
Eyede International Limited
Level 1, 5 Bouverie Street
PETONE
PO Box 31 012
Lower Hutt
Phone +64 4 939 8764
Fax +64 4 939 6719
www.eyede.com
More information about the thelist
mailing list