Home » RDBMS Server » Server Administration » Two different columns in different tabels
Two different columns in different tabels [message #370006] Tue, 28 November 2000 01:13 Go to next message
Karri Lahtela
Messages: 16
Registered: November 2000
Junior Member
Hi!

I have this kind of problem:
In table1 I have a column Address. If this column has a value it must be taken. but if it is empty, then I must take value from table2, where column name is Address2.
Regards: Karri
Re: Two different columns in different tabels [message #370008 is a reply to message #370006] Tue, 28 November 2000 06:52 Go to previous message
Prem
Messages: 79
Registered: August 1998
Member
Karri,

You'll have to substitute the table1 and table2 to your tables and the join condition and it should work.

SELECT DECODE (A.ADDRESS, NULL, B.ADDRESS2, A.ADDRESS)
FROM TABLE1 A, TABLE2 B
WHERE A.PRIMARY_KEY = B.PRIMARY_KEY

hth

Prem :)
Previous Topic: SQL- Help
Next Topic: DBF Files
Goto Forum:
  


Current Time: Fri May 03 03:55:44 CDT 2024