J
joemeshuggah
im new to the world of sql, so im not sure if this is can even be
accomplished in a single query or if two separate queries are required. i am
trying to put together a query where the end result is based on a condition
of an aggregate...i want the sum of the amount billed (and all other
information requested) to appear based on a condition that involves an
operation on the amount billed.
for example:
select name, account, cycle date, sum(amount billed) from billing
information group by name, account, cycle date where ((1-((select amount
billed from billing information where promo id is not null)/(select amount
billed from billing information where promo id is null)))) <>0.19
ive tried a number of different ways, but continually get error messages.
can you use the sum aggregate and include a condition on the attribute being
summed?
accomplished in a single query or if two separate queries are required. i am
trying to put together a query where the end result is based on a condition
of an aggregate...i want the sum of the amount billed (and all other
information requested) to appear based on a condition that involves an
operation on the amount billed.
for example:
select name, account, cycle date, sum(amount billed) from billing
information group by name, account, cycle date where ((1-((select amount
billed from billing information where promo id is not null)/(select amount
billed from billing information where promo id is null)))) <>0.19
ive tried a number of different ways, but continually get error messages.
can you use the sum aggregate and include a condition on the attribute being
summed?