Last post Feb 02, 2016 07:21 AM by sandeepmittal11
Feb 01, 2016 01:47 PM|sudip_inn|LINK
this way i some time work
select * from accounts where 'dennis' IN (SurName,DisplayName)
but if i give partial words like den or nn then above query refuse to return result. so what would be best sql to search string data in multiple column.
Feb 01, 2016 04:29 PM|gapimex|LINK
You can try:
select * from accounts
where exists (select 1 from (values (SurName), (DisplayName)) v(Name)
where v.Name like '%den%')
Hope this help
Feb 01, 2016 05:52 PM|sudip_inn|LINK
is it sql server specific code ?
never saw this kind of code before.
what is values() function does ?
what is v(Name) means........any kind of alias?
Feb 01, 2016 08:19 PM|gapimex|LINK
Check out the page below:
Feb 02, 2016 12:55 AM|oned_gk|LINK
Sometime i do
select * from accounts where (SurName + '-' + DisplayName) LIKE '%dennis%'
Feb 02, 2016 07:21 AM|sandeepmittal11|LINK
select * from accounts where (SurName like '%den%' or DisplayName like '%den%')