dumb question: query based upon condition

razorking

Registered User.
Local time
Today, 02:21
Joined
Aug 27, 2004
Messages
332
in the following example:

SELECT [inventory table].[item number], [inventory table].abc, Max([inventory table].[count date]) AS [last count], Max([count date]+15) AS [next count]
FROM [inventory table]
GROUP BY [inventory table].[item number], [inventory table].abc
HAVING ((([inventory table].abc)="a"))
ORDER BY Max([inventory table].[count date]) DESC;

How can I get the query to calculate a different "next count" depending on what the value of "abc" is?

calculate + 15 if abc =a
calculate + 25 if abc =b
calculate + 60 if abc =c

I know how to do it on three seperate queries but would like to do it on one.

Thanks!
 
razorking said:
in the following example:
SELECT [inventory table].[item number], [inventory table].abc, Max([inventory table].[count date]) AS [last count], Max([count date]+iif([inventory table].abc="a",15,iif([inventory table].abc="b",25,60))) AS [next count]
FROM [inventory table]
GROUP BY [inventory table].[item number], [inventory table].abc
ORDER BY Max([inventory table].[count date]) DESC;
Bit in blue :)

Vince
 
Thank You!

ecniv (Vince)

Thanks for helping me get one more thing off of my mind. The query now works great.

Thanks again!

razorking
 

Users who are viewing this thread

Back
Top Bottom