Display Custom Text Based on an IF.

Clut

Registered User.
Local time
Today, 19:00
Joined
May 5, 2010
Messages
29
Hi,

I have a bunch of queries that run on a table of tasks to split them out into:

a) Completed Tasks (task_completion_date field is not null)
b) Pending Tasks (task_due_date is greater than now() )
c) Overdue Tasks (task_due_date is less than now() )

What I would also like is a query that combines b) and c) above, so it shows all tasks that have not yet been completed, regardless of whether the task is overdue or not.

This in itself is easy of course, however I'd like an additional field entered at the end of the query which says 'Pending' or 'Overdue'.

In Excel, if would be something like:

if(task_due_date => now(),"Pending","Overdue")

If the task is not yet past the due date, then write "Pending", otherwise write "Overdue".


Is this possible with sql?
Many Thanks.
 
Immediate IF and Date functions should cover it, no?
Like this par example:

IIf([task_due_date]>=date(),"Pending","Overdue") AS Expr1

Or were you looking for something more complex?
 
Student,

Thanks, that does the job fine.

I guess it was a pretty simple question (hence the 'were you looking for something more complex' bit), but I'd just not used IIF before, and was unsure as to the syntax.

Thanks very much.
 
No worries Clut - all pretty new to me & experiencing a rather steep learning curve at work atm. Was starving before lunch so thought I'd clarify in case I hadn't followed your requirements properly :-)

Any chance of a 'Thanks' on that one? (bottom right of my post). Not sure how to mark a question as 'solved' on here either I'm afraid - any takers on that one?
 

Users who are viewing this thread

Back
Top Bottom