PDA

View Full Version : (seemingly) simple query question


kuzma725
02-11-02, 19:07
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.

rwilkerson
02-12-02, 09:17
I don't know which tables contain which data, but an outer join should do what you need.


SELECT table1.type0
, table2.type1
FROM table1 RIGHT JOIN table2
ON table1.field = table2.field


Hope this helps.