November 16, 2010 at 2:55 am
Hi all,
can anybody say that
how can i use IN and LIKE both togather in same query and same field ?
select * from pe where yno in like (
'%85452-1',
'%29212-2',
'%61954-1',
'%34483-2')
above query gives me following error :
Incorrect syntax near the keyword 'like'.
thanks
November 16, 2010 at 3:10 am
KcV (11/16/2010)
Hi all,can anybody say that
how can i use IN and LIKE both togather in same query and same field ?
select * from pe where yno in like (
'%85452-1',
'%29212-2',
'%61954-1',
'%34483-2')
above query gives me following error :
Incorrect syntax near the keyword 'like'.
thanks
Ok, this is purely what you asked for and not my recommendation:
select [columnnames] from pe where yno in (select [columnname] from pe
where yno like
'%85452-1'
or yno like '%29212-2'
or yno like '%61954-1'
or yno like '%34483-2')
Since the column names in your "IN" and "LIKE" statement are the same, try the following:
select [columnames] from pe where yno like
'%85452-1'
or yno like '%29212-2'
or yno like '%61954-1'
or yno like '%34483-2'
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This thing is addressing problems that dont exist. Its solution-ism at its worst. We are dumbing down machines that are inherently superior. - Gilfoyle
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply