As I was putting together some sample data for you I figured out that the query above does work but not when I applied it to my real data.
I found out that if there are no ROGs, it returns NULL instead of 0, so I had to use:
Code:
SELECT COALESCE(SUM(quantity),0) FROM rog_bom WHERE po_ID=po.ID
Leave a comment: