sql server 2008 - IF statement with Transact SQL -


when execute transact sql code

if (select model_id request_unit request_id = '4357') null     select part_id request_unit request_id = '4357' else      select model_id request_unit request_id = '4357' 

i receive following error:

subquery returned more 1 value. not permitted when subquery follows =, !=, <, <= , >, >= or when subquery used expression.

how using coalesce()?

select coalesce(model_id, part_id) request_unit  request_id = '4357'; 

the if not needed.

the error seems pretty self-explanatory. there more 1 row in request_unit request_id 4357.


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -