Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

case statement in select query in sql

INSERT INTO HumanResources.departmentcopy(DepartmentID, GroupName, Name, temp)
SELECT  DepartmentID,
        GroupName,
        Name,
        CASE WHEN DepartmentID = 1 AND Name = 'Engineering and Research'
        THEN 'sucessful' ELSE 'unsucessful' END
FROM HumanResources.department
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #case #statement #select #query #sql
ADD COMMENT
Topic
Name
2+2 =