Link to home
Start Free TrialLog in
Avatar of szadroga
szadrogaFlag for United States of America

asked on

SQL IIF Statement in SSMS 2005

I already have a query that returns data that i need for a report in SSMS 2005.  I need to generate a column named 'FeedbackTrue' to the already returned data set.  I want this column to contain only 1's and 0's.  

In Access under query designer, i would have just wrote a formula like FeedBackTrue:=IIF(columnname>=Value, 1,0) and then i would have my column of data.

How do i do this query designer within SQL Server Mgmt Studio 2005 under query designer.

I pasted my current query, and i want to base the new column off the value of the CreatedDate column.
SELECT DISTINCT 
                      TblUsers.PK_Users, TblDepartment_lookup.DepartmentName, TblUsers.FullName, TblFeedback.CreatedDate
FROM         TblDepartment_lookup INNER JOIN
                      TblUsers ON TblDepartment_lookup.PK_Department = TblUsers.FK_Department LEFT OUTER JOIN
                      TblFeedback ON TblUsers.PK_Users = TblFeedback.FK_User
GROUP BY TblDepartment_lookup.DepartmentName, TblUsers.FullName, TblFeedback.CreatedDate, TblUsers.PK_Users
ORDER BY TblDepartment_lookup.DepartmentName, TblUsers.FullName

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Aneesh
Aneesh
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of szadroga

ASKER

Thank you so much!  I couldnt get the syntax right and it was driving me nuts!!!