Why to use subquery to filter data, if you can use a "
condition
" directly?!?
select *
from tblBusinessCategory as b
inner join tblUser as u on b.BusinessID=u.BusinessCategoryId
inner join tblAddress as a on u.AddressId=a.AddressID
where b.BusinessCategory LIKE '%d%'
Please, take a look at this excellent article:
Visual Representation of SQL Joins[
^] to understand how join's work.
#1 ) Conversion failed when converting the nvarchar value 'Dentist' to data type int. how to solve this ??
BusinessCategoryId
is not the same as
BusinessCategory
. To be able to get proper data, you have to write:
where u.BusinessCategoryId in (select BusinessCategoryId from tblBusinessCategory where BusinessCategory LIKE '%d%')
But! I do not recommend to use subquery like this, because of performance issue!
#2 ) How to perform like operation on multiple columns??
Write proper WHERE statement!
WHERE ((Column1 Like '%a' AND (Column2 = 1 OR Column3 = 2)
#3 ) Is this possible to call this query in mvc4 controller ??
I do not understand you... ;(