Subject | Re: Why won't this query work? |
---|---|
Author | Alexander V.Nevsky |
Post date | 2003-05-19T19:27:25Z |
--- In ib-support@yahoogroups.com, "dixonepperson" <edepperson@j...>
wrote:
standard.
Best regards, Alexander.
wrote:
> SELECT p.PO_NUM, c.CO_NAME AS VENDOR, a.ADR_ADR1 AS VADR1,a.ADR_ADR2
> AS VADR2,Dixon, you should group by _all_ non-aggregate column, it is SQL
> a.ADR_CITY AS VCITY, a.ADR_ST AS VSTATE, a.ADR_ZIP AS VZIP,
> p.PO_DATE, p.PO_ETA, p.PO_CFM, p.PO_INV, p.PO_TOTAL, p.PO_DISC,
> p.PO_TAX, p.PO_GTOT,
> n.DNAME, n.DADR1, n.DADR2, n.DCITY, n.DST, n.DZIP, SUM(d.PD_QTY)
> FROM POTABLE p
> LEFT JOIN COMPANY c ON (p.PO_VENID=c.CO_IDNUM)
> LEFT JOIN ADDRESS a ON (p.PO_VENID=a.ADR_IDNUM AND a.ADR_DEF= 'Y')
> LEFT JOIN OFFICEPO n ON (p.PO_LOCID=n.DID)
> LEFT JOIN PODETAIL d ON (p.PO_NUM=d.PD_NUM)
> WHERE p.PO_NUM='119' GROUP BY p.PO_NUM
>
> The issue is with the SUM() function. I get SQL error 104, invalid
> column reference when I try to run.
standard.
Best regards, Alexander.