Am Donnerstag, 30. Juni 2005 11:27 schrieb Nick Stone: > SELECT > tbl1."TermTypeID", > tbl1."ParentID", > tbl1."KeywordID", > tbl1."Term", > tbl2."KeywordID" > FROM > "Terms" As tbl1 LEFT JOIN > "SearchStore" As tbl2 ON tbl1."KeywordID" = tbl2."KeywordID" > WHERE > (tbl1."TermTypeID" >= 200) AND > (tbl1."TermTypeID" < 600) AND > (tbl1."IsSynonym" = false) AND > (tbl1."LanguageID" = 1) AND > (tbl2."StockID" = 1) > ORDER BY > tbl1."TermTypeID", > tbl1."Term"; > > Just to be obvious both queries as far as I can should return everything > from Terms and anything if it exists from SearchStore subject to the WHERE > clause parameters - obviously!
The condition (tbl2."StockID" = 1) will remove all rows that have null values in the tbl2 fields, thus making your left join useless. Perhaps you should change that to (tbl2."StockID" = 1 OR tbl2."StockID" IS NULL) -- or use your first version. -- Peter Eisentraut http://developer.postgresql.org/~petere/ ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]