> I don't know if the plan would be the same but this is a bit clearer: > > WHERE COALESCE(b.quantity, 0) > COALESCE(b.deliveredsum, 0) That should be true, but sometimes we get deliveries of greater quantity then we ordered. I just want to know the times when I haven't gotten the complete order yet. If we get more then we ordered, I don't want it to be in this query. ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend