How to use IN in SQL Server with Select -
select category pea_template temp_id = 000001 , temp_version = 2
this query returns '000001','000002'
saved in category
column in format.
select * hr_category cat_code in ('000001', '000002')
this select working fine row string
select * hr_category cat_code in (select category pea_template temp_id = 000001 , temp_version = 2)
but when use query inside in not return value.
what reason this? way fix this?
if category can have concatenated strings apostrophe e.g. '000001'
or '000001','000002'
, better use join construction, this:
select * hr_category inner join (select category pea_template temp_id = 000001 , temp_version = 2) pea on pea.category '%'''+cat_code+'''%'
Comments
Post a Comment