Subject | Conditional grouping? |
---|---|
Author | Rick Debay |
Post date | 2005-07-28T16:20Z |
I'm probably being dense, but I can't figure out how to do a conditional
grouping.
I need to sum quantities based on these columns (GPI, TEE, UNIT_DOSE),
but also on an additional column (DOSE_SIZE) if one of first set
(UNIT_DOSE) meets certain criteria.
GROUP BY
GPI, TEE, UNIT_DOSE, (IF UNIT_DOSE IN ('X','U') DOSE_SIZE)
The only thing I could come up with is to do two queries, union them,
and then sum that.
Rick DeBay
grouping.
I need to sum quantities based on these columns (GPI, TEE, UNIT_DOSE),
but also on an additional column (DOSE_SIZE) if one of first set
(UNIT_DOSE) meets certain criteria.
GROUP BY
GPI, TEE, UNIT_DOSE, (IF UNIT_DOSE IN ('X','U') DOSE_SIZE)
The only thing I could come up with is to do two queries, union them,
and then sum that.
Rick DeBay