|
Prev: Can't open query in SQL View to correct query ("Join expression not supported")
Next: postcode finder, lookup,search
From: Ivan Carey on 6 Jul 2005 08:59 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
From: lesperancer on 6 Jul 2005 13:05
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 |