CONTACT DATA:
ACCOUNT_ID | CONTACT_NAME| JOB_TITLE
---------------------------------------------------
10000000001 | ABC | CEO
10000000001 | DEF | CIO
10000000002 | OPQ | CEO
10000000002 | XYZ | HR
SELECT JOB_TITLE
FROM CONTACT WHERE ACCOUNT_ID = 10000000001
UNION
SELECT JOB_TITLE
FROM CONTACT WHERE ACCOUNT_ID = 10000000002
Result:
JOB_TITLE
------------
CEO
CIO
HR
SELECT JOB_TITLE
FROM CONTACT WHERE ACCOUNT_ID = 10000000001
UNION ALL
SELECT JOB_TITLE
FROM CONTACT WHERE ACCOUNT_ID = 10000000002
Result:
JOB_TITLE
-------------
CEO
CIO
CEO
HR
Friday, April 17, 2009
UNION & UNION ALL
at 7:35 PM
Labels: Oracle, Oracle Query, PL/SQL
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment