Home » SQL & PL/SQL » SQL & PL/SQL » select unique rows
select unique rows [message #1916] Mon, 10 June 2002 23:07 Go to next message
Michael
Messages: 61
Registered: October 1999
Member
Hello.
I have a select that result is same this

select a1.cola,a2.colb,a2.colc from table1 a1,table2 a2 where a1.cola=a2.cola

COLA COLB COLC
aaa 1 null
aaa null 2
bbb 3 null
bbb null 4

and i want merge rows in unique row, only not null columns
for example...
COLA COLB COLC
aaa 1 2
bbb 3 4

It is posible???

thank you
Re: select unique rows [message #1918 is a reply to message #1916] Tue, 11 June 2002 06:22 Go to previous message
Lars O Sjöström
Messages: 25
Registered: May 1999
Junior Member
I think that a DISTINCT will do the trick.

SELECT DISTINCT COLA, COLB, COLC
FROM ...
WHERE COLA IS NOT NULL OR COLB IS NOT NULL OR COLC IS NOT NULL
Previous Topic: how to identify only a non numeric data
Next Topic: Building a string based on multiple fields
Goto Forum:
  


Current Time: Mon May 20 15:08:52 CDT 2024