returning 0 records

  • 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

  • Just do an inner join instead of a full outer join.

  • Thanks. That worked.

  • 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.

    Inner Joins

    Outer Joins

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply