March 30, 2012 at 1:00 pm
I have a query:
SELECT 'TEST',t1.name+', '+t2.address
FROM table1 t1 full outer join table2 t2 on t1.id=t2.id
WHERE t2.address='xyz'
Because of the static first column (TEST) my query always returns one row. How do I adjust the query to return 0 rows when there was no match in t1 and t2 tables?
Thanks
March 30, 2012 at 1:03 pm
Just do an inner join instead of a full outer join.
March 30, 2012 at 1:07 pm
Thanks. That worked.
March 30, 2012 at 1:12 pm
No problem. Checking out the documentation can help give you a better understanding of the difference between the two if you are still having troubles.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply