Subject Re: [firebird-support] Re: SQL and Left Outer Join.
Author Martijn Tonies
> > Either post it somewhere for download (so others can have
> > a try as well) or send it to m.tonies @ upscene.com
> >
>
>

SELECT
T1.PLU_NR,
T2.AFDELING_ID,
T2.ANTALSTK,
SUM( T3.ANTAL ),
SUM( T3.KANTAL )
FROM T2
RIGHT OUTER JOIN T1 ON (T2.VAREPLU_ID = T1.PLU_NR)
LEFT OUTER JOIN T3 ON (T2.VAREPLU_ID = T3.VAREPLU_ID) AND
(T2.AFDELING_ID = T3.AFDELING_ID) and
(((T3.aar*100)+T3.MDR)>=200408)
/* put the WHERE in here -> so either this and the join condition, or the
LEFT OUTER stuff */
WHERE
(
(T1.plu_Nr = '000010')
)
GROUP BY
T1.PLU_NR,
T2.AFDELING_ID,
T2.ANTALSTK
ORDER BY
T1.PLU_NR,
T2.AFDELING_ID

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com