Using Cross Apply on Greenplum

192 views Asked by At

I would like to know if there's a way to use cross apply the way I'm using it on MSSQL.

Select
    pt.PersonName,
    psc.Charges,
    psc.Taxes
from tbl.PersonTable pt
cross apply(
        Select
        PersonName,
        sum(Charges) Charges,
        sum(Taxes) Taxes
        From tbl.PersonSumCharges psc
        Where psc.PersonID = pt.PersonID
        Group by PersonName
    )psc

I'm quite new to Greenplum so I apologize for this noobish question. :)

1

There are 1 answers

0
Gordon Linoff On

Just use a join and group by:

Select PersonName, sum(Charges) as Charges, sum(Taxes) as Taxes
From tbl.PersonTable pt left join
     tbl.PersonSumCharges psc
     on psc.PersonID = pt.PersonID
Group by pt.PersonName;

I don't think that Greenplum supports lateral joins.