I have 2 tables 1 has a date field and component need by that date and
the
other has all the upcoming orders.
I am trying to build a query that will give me the Date and ComponentNeed
and also how many components have been ordered before that date and how
many
after.
PostGreSQL is telling me I
I have 2 tables 1 has a date field and component need by that date and the
other has all the upcoming orders.
I am trying to build a query that will give me the Date and ComponentNeed
and also how many components have been ordered before that date and how many
after.
PostGreSQL is telling me I need
I got it.
I had to put the whole case statement into the sum so my statement ended up:
select a.DueDate,a.PartID,a.AmountNeeded,a.CurrentStock,
sum(coalesce(case when b.DatePromisedBy<=a.DueDate
then coalesce(b.QuantityOrdered,0)-coalesce(b.DeliveredSum,0)
end,0)) as ExpectedBefore,
sum(coale