Subject Re: JOIN NOT WORKING CORRECTLY
Author Dixon Epperson
Thanks Alexandre

I just couldn't see it, but I should have. it work right now.

Dixon Epperson
> I will reformat your query, since I think will be easier to read
it...
>
> The problem is that in your WHERE clause will filter records using
PO_LOCID
> = WH_LOCID (if you do not have a PO for the product the PO_LOCID
will be
> null and NULL is not equal to anything), so the where clause is
resticting
> the result set to return only the products that has PO. use the
filter
> condition on the join clause, since you specify left join even the
products
> that does not have PO will be retrivied.
>
> try something like
>
> SELECT
> WH_STCK, WH_BC, SUM(WH_QTY), PR_NAME ||' '||PR_DESC,
> PR_PARLVL, PD_QTY, PO_ETA
> FROM
> WAREHOUSE JOIN
> PRODUCT ON (WH_STCK=PR_STOCKNO) LEFT JOIN
> PODETAIL ON (PD_STCK LIKE WH_STCK ||'%') LEFT JOIN
> POTABLE ON (PD_NUM=PO_NUM and PO_LOCID = '000011' and PO_LOCSEQ
= 100
> and PO_INV = '')
> WHERE
> WH_LOCID='000011' AND
> WH_LOCSEQ=100
> GROUP BY
> WH_STCK, WH_BC, PR_NAME, PR_DESC, PR_PARLVL, PD_QTY, PO_ETA
> HAVING
> SUM(WH_QTY) < PR_PARLVL *1.10
>
> HTH
>
>
> Alexandre Benson Smith
> Development
> THOR Software e Comercial Ltda.
> Santo Andre - Sao Paulo - Brazil
> www.thorsoftware.com.br