cas de sélection SQL lorsque
--CREATE SOME SAMPLE DATA
CREATE TABLE Casedata
(
NAME VARCHAR(10)
);
INSERT INTO Casedata VALUES ('Test 1');
INSERT INTO Casedata VALUES ('Test 2');
INSERT INTO Casedata VALUES ('None');
-- CASE WHEN IN SQL
SELECT NAME,
CASE
WHEN NAME = 'Test 1' THEN 'The value is 1'
WHEN NAME = 'Test 2' THEN 'The value is 2'
ELSE 'Sorry no Match'
END
FROM Casedata
Sore Seal