Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

summation query on different fields

Status
Not open for further replies.

Honestmath

Technical User
Jan 8, 2003
25
US
hey,

i have this table setup something like this

fields:
id
numparticipants
responded

id can occur lots of times and i want to sum numparticipants for each id for responded = positive, responded=negative and responded=false.

can i do this all in the same query?

thnx a bunch - math



 
select id,sum(iif(responded='positive',1,0) as positive,
sum(iif(responded='negative',1,0) as negative ,
sum(iif(responded='false',1,0) as falsies
from t
group by id
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top