Re: SELECT help
drop table if exists emails;
create table emails(ou char(8),email_address char(128));
insert into emails values('-','ou default addr'),('home','1st_addr'),('home','2nd_addr'),('home','');
SELECT
IF( LENGTH(email_address)>0,
email_address,
(SELECT email_address FROM emails WHERE ou = '-')
) as addr
FROM emails
WHERE ou LIKE 'HOME%' ;
+-----------------+
| addr |
+-----------------+
| 1st_addr |
| 2nd_addr |
| ou default addr |
+-----------------+
What's the issue?
Subject
Views
Written By
Posted
2072
November 01, 2012 01:06PM
Re: SELECT help
1037
November 01, 2012 03:12PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.