I'm connecting to a DB2 database and want to use the Max(PO180M1.POORDT) or the TOP 1 grouping by the PO180M2.PHPPN (PARTNO). How would I do this? I think I keep getting close but not getting it to work.
SELECT PO180M2.PHPPN AS PartNo, (PO180M2.PHVNPD || ' ' || PO180M2.PHVNP2) AS PartDesc,
PO180M1.POORDT AS OrderDate, PO180M2.PHUNCT AS UnitCost
FROM PO180M1, PO180M2
WHERE PO180M1.POORNO = PO180M2.PHORNO
ORDER BY PartNo, OrderDate DESC
Aucun commentaire:
Enregistrer un commentaire