If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > (seemingly) simple query question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-11-02, 18:07
kuzma725 kuzma725 is offline
Registered User
 
Join Date: Jan 2002
Posts: 4
(seemingly) simple query question

I have a table that looks like this:

x t
- ----
1 0
2 0
1 1
2 1
3 1

How do I query it to get this:

t0 t1
-- --
1 1
2 2
NULL 3

the formatting is messed up, but there are 2 fields: type0 with records 1,2,NULL and type1 with records 1,2,3

Please help if you can, this is urgent.
Thanks In Advance, Yury.
Reply With Quote
  #2 (permalink)  
Old 02-12-02, 08:17
rwilkerson rwilkerson is offline
Registered User
 
Join Date: Feb 2002
Location: Baltimore, MD
Posts: 26
I don't know which tables contain which data, but an outer join should do what you need.

Code:
SELECT   table1.type0
              , table2.type1
FROM      table1 RIGHT JOIN table2
                                     ON table1.field = table2.field
Hope this helps.
__________________
Rob Wilkerson
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On