Skip to content
Advertisement

Generate two SUM value columns for two different dates separately in one query

I am trying to combine two queries

.

and I want it so there is one table with one column for s.id and the next columns are VAL columns for each respective date. Where a value is not available for a give s.id on a specific date it should show NA.

Advertisement

Answer

I supppose you are looking for conditional aggregation (CASE WHEN inside the aggregation function).

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement