I would like to create a view from the following table. This table contains many many records and my goal is to have a view hold certain TOTALS (sums) for Column A and Column B but based on different WHERE clauses. Currently I have created two separate views to keep track of the sums that I need.
My question is if I can do this in one view as opposed to two separate views.
TABLE: USERID TIME COLUMN A COLUMN B
I want to keep track of the following two totals:
TOTAL 1: SELECT USERID, SUM(TIME) FROM TABLE WHERE COLUMN A <> 0
TOTAL 2: SELECT USERID, SUM(TIME) FROM TABLE WHERE COLUMN B <> 0
Is there a way to get these 2 totals in one query?
1 Answer