I have a View called View1 with the field ID, F1, F2, F3. Now I need to check if (Total F1 < Total F2 + Total F3) per ID, if yes fetch all records (so if condition matches, I need to bring rows, not only totals) how can I write my view query to handle this?
Thanks,
SELECT *
FROM view1 v
WHERE id IN (SELECT id FROM view1 WHERE id = v.id AND SUM(f1) < SUM(f1)+SUM(f2) GROUP BY id)
Nick
No comments:
Post a Comment