score:2

Accepted answer

If you need to pick up "first" IDType you can do it with one of window function, say ROW_NUMBER

SELECT * FROM 
(
SELECT t.* , ROW_NUMBER() OVER (ORDER BY IDType ) rn 
FROM table1 t 
WHERE IDType IN (1,2,4,5,6,7,8,9,10,11,12,13,15,16,17,18,19)
) a 
WHERE rn =1;

Updated to add partition by employee_id (assuming table has employee_id field)

 SELECT * FROM 
(
SELECT t.* , ROW_NUMBER() OVER (PARTITION BY t.employee_id ORDER BY IDType ) rn 
FROM table1 t 
WHERE IDType IN (1,2,4,5,6,7,8,9,10,11,12,13,15,16,17,18,19)
) a 
WHERE rn =1;

score:1

In SQL Server COALESCE does not have explicit limitation about quantity on parameters.

Your reading your problem it sounds like a logic problem, that you must have resolve using the Case (Transact-SQL).

COALESCE (Transact-SQL) is to resolve null issues.


More questions

More questions with similar tag