If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
If then else statements in sql
I want my query to return a message based on the input received. How do I
make this statement return a message to the same column ( IIf(IsNull(projects.date_filled),'Not filled',' ') ) AS Message I want to be able to return a different message if the projects.date_ filled is not null. Here is the complete code: SELECT Projects.Project, Projects.Position, Projects.Date_Open, Projects.Date_Filled, Projects.Recruiter, nz(Int(Projects.Date_Filled-Projects.Date_Open),0) AS Time_to_Fill, Workdays(Projects.Date_Open,nz(Projects.Date_Fille d,Date())) AS No_Working_Days, ( IIf(IsNull(projects.date_filled),'Not filled',' ') ) AS Message FROM Projects; Thanks, Akilah |
#2
|
|||
|
|||
If then else statements in sql
You should be able to return text like this:
IIf([projects].[date_filled] Is Null, "Not filled", "Filled") AS Message -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Akilah" wrote in message ... I want my query to return a message based on the input received. How do I make this statement return a message to the same column ( IIf(IsNull(projects.date_filled),'Not filled',' ') ) AS Message I want to be able to return a different message if the projects.date_ filled is not null. Here is the complete code: SELECT Projects.Project, Projects.Position, Projects.Date_Open, Projects.Date_Filled, Projects.Recruiter, nz(Int(Projects.Date_Filled-Projects.Date_Open),0) AS Time_to_Fill, Workdays(Projects.Date_Open,nz(Projects.Date_Fille d,Date())) AS No_Working_Days, ( IIf(IsNull(projects.date_filled),'Not filled',' ') ) AS Message FROM Projects; Thanks, Akilah |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
SQL statements | bbdobuddy | Using Forms | 1 | May 10th, 2005 01:31 AM |
Code Not Working | DS | New Users | 11 | May 9th, 2005 10:55 PM |
Checking for results of SQL statements without saving queries. | Amir | Running & Setting Up Queries | 1 | January 21st, 2005 10:05 AM |
Access and SQL | AHopper | General Discussion | 26 | August 3rd, 2004 07:01 PM |