+ 3
Why wont this code return results for the second query?
I am a beginner with SQL and have been going through various SQL challenges online. Im currently working on: https://www.testdome.com/questions/sql/pets/12347?type=FromTest&generatorId=12&questionIds=13651%2c14246%2c12347 I have tried various methods, but what I believed to be the best isn't working. I did: select distinct name from dogs; select distinct name from cats where name != (select name from dogs); But it will not return any cat names, any thoughts?
3 Antworten
+ 6
you were close.
select distinct name from dogs
union
select distinct name from cats;
try this one.
+ 4
you're welcome. hey, you can do it without distinct, because union by itself will remove the duplicate rows
+ 1
Looks like I was overthinking it, lol. Thank you!