Have a problem with my SQL Server stored procedure query output. Currently using this:
SELECT *
FROM Head H
INNER JOIN Line L ON H.invno = L.invno
INNER JOIN Misc M ON H.invno = M.invno
INNER JOIN QSMU Q ON H.invno = Q.invno
WHERE H.invno = @Invno
AND L.deleted = 0
AND M.deleted = 0
AND Q.deleted = 0
This code purpose is to show everything on my reporting service except the deleted one (filter it using a 'Deleted' column name instead of dropping some row(s).)
Now the problem is, if one of it doesn't have data, e.g: table M doesn't have anything, then the output will be blank.
Iv'e tried changing the logic to OR, but you know, the output will be funny (the 'Deleted = 1' will shown in the output and I don't want that.