User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 391,901 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,596 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser:
Views: 2195 | Replies: 1
Reply
Join Date: Oct 2004
Location: San Francisco, CA
Posts: 337
Reputation: paradox814 is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 1
paradox814's Avatar
paradox814 paradox814 is offline Offline
Posting Whiz

Help select with outer join

  #1  
Apr 13th, 2006
ok so I have two tables, and I believe I need an outer join

lets say these are them:
 CREATE TABLE t1 (
     xid INT PRIMARY,
     data1 VARCHAR(50) );

CREATE TABLE t2 (
     xid INT PRIMARY,
     data2 VARCHAR(50) );
so here is an explanation of the tables

t1.xid = t2.xid

for every row in t1.xid, there is a guaranteed matching t2.xid, but the same in not true in reverse

now I want to do somthing like this:
SELECT t1.xid, t1.data1, t2.data2
FROM t1,t2
WHERE t1.xid=t2.xid

but I want it to select EVERY row in t1 AND t2 even if a row does not exsist in both tables

Thanks.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2005
Location: Dallas, TX
Posts: 481
Reputation: campkev is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 19
campkev campkev is offline Offline
Posting Pro in Training

Re: select with outer join

  #2  
Apr 19th, 2006
don't use mysql buth this works in ms-sql:

select t1.xid,t1.data1, t2.data2 from t1
right join t2 on
t1.xid = t2.xid
Last edited by campkev : Apr 19th, 2006 at 1:23 pm. Reason: correction
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb MySQL Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the MySQL Forum

All times are GMT -4. The time now is 7:31 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC