|Subject||AW: [firebird-support] Difficult condiion question|
Set, many thanks for your kind support :)
Von: email@example.com [mailto:firstname.lastname@example.org]
Gesendet: Donnerstag, 28. August 2014 15:33
Betreff: RE: [firebird-support] Difficult condiion question
>I think I have it:
>Good to hear that you figured it out, Olaf. Sorry for misleading you and writing code that returned records if TT.MINB > 0 regardless of ls.menge. You can still reduce your query by one line if you want, LS.MENGE IS NOT NULL can simply be removed.
>SELECT TT.TEILENR, TT.BEZEICHNUNG, LS.MENGE, TT.MINB, LS.TYP, TT.TYP
>FROM TTEILE TT
>LEFT JOIN TLAGER_SUM LS
>ON TT.TEILENR = LS.TEILENR
>AND LS.TYP = 1
>AND (LS.MENGE IS NOT NULL
>OR TT.MINB>0 and ls.menge is null)
>ORDER BY TT.TEILENR;
>The and ls.typ = 1 should exclude all records from tlager_-sum there not typ 1? It was fine!!!!! Thank you
>Can you tell me what about the statements before the where conditions? Until now I don't know about.
>Your syntax returns me too many records, some of them has entries in the table tlager_sum, but the amount and the present typ (1) returns me this statement, it is null.
The statements before the WHERE condition are part of the LEFT JOIN. Typically, that's where you put criteria relating to the right table. If you write such criteria in the WHERE clause, they could (logically speaking) turn the LEFT JOIN into an INNER JOIN.