469,579 Members | 1,241 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,579 developers. It's quick & easy.

multiple contition field in a query

How can a query display multiple fields with diferent condition on the same
field
example

I have a field name of reason and a field name of duration. I would like to
display 2 fileds of total duration but each have different reasion criteria.

display Total Recall based on a calculation that adds the total duration for
each record that has a criteria of RC
on the same query display Total Shift based upon a calculation that adds the
total duration for each record that has a criteria of TR, AL, OT

I can do this in a query that only displays either the Total Recall or Total
Shift but not both in the same query.

Is there a way to this

Thanks,
Ivan
Nov 13 '05 #1
1 1594

SELECT sum(IIF(reason = 'RC', duration, 0)) as totalRecall,
sum(IIF(reason = 'TR', duration,
IIF(reason = 'AL', duration,
IIF(reason = 'OT', duration, 0))) as totalShift FROM ....

Ivan Carey wrote:
How can a query display multiple fields with diferent condition on the same
field
example

I have a field name of reason and a field name of duration. I would like to
display 2 fileds of total duration but each have different reasion criteria.

display Total Recall based on a calculation that adds the total duration for
each record that has a criteria of RC
on the same query display Total Shift based upon a calculation that adds the
total duration for each record that has a criteria of TR, AL, OT

I can do this in a query that only displays either the Total Recall or Total
Shift but not both in the same query.

Is there a way to this

Thanks,
Ivan


Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Epetruk | last post: by
4 posts views Thread by Martin Lacoste | last post: by
5 posts views Thread by Beacher | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.