This content has been marked as final. Show 5 replies
select unique(videoLinks) from saVideos where sa_id=21
select unique(picLinks) from saImages where sa_id=21
try this1 person found this helpful
select videoLinks from saVideos where sa_id=21
select picLinks from saImages where sa_id=21
Hi,1 person found this helpful
Use Minus operator.
Hope this helps.
WITH saVideos AS( SELECT 'www.testing.com' AS VIDEOLINKS FROM dual), saImages AS( SELECT 'test' AS IMG FROM dual UNION ALL SELECT 'test14' FROM dual UNION ALL SELECT 'www.hello.com' FROM dual UNION ALL SELECT 'www.testing.com' FROM dual ) SELECT * FROM saImages MINUS select * from saVideos
PS-> Mark as COmplete/Answer if it meets your expected result
minus could do a trick, but it seems to me that 'INTERSECT' instead of minus would work better.1 person found this helpful
Unfortunatly you didn't mention the expected output. I guess it would be the one line1 person found this helpful
in that case simply join the two tables.
If needed then you could change the select list to retrieve only distinct values.
select * from saVideos v join saImages i on i.sa_id = v.sa_id and i.picLinks = v.videoLinks where v.sa_id=21;
I usually avoid distinct/unique whereever possible. This requires the database to do a sort and makes the query slow.
select unique v.sa_id, v.videolinks from saVideos v join saImages i on i.sa_id = v.sa_id and i.picLinks = v.videoLinks where v.sa_id=21;
Edited by: Sven W. on Feb 10, 2011 1:55 PM