By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,686 Members | 2,708 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,686 IT Pros & Developers. It's quick & easy.

multiple contition field in a query

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a

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.