Reputation: 245
Attached image is the inner join table. I want to make a search on the inner join table, between Title, Description and also the companyName. I not sure what is wrong with the query and please advise.
The results of table i'm searching on
SELECT campaign.name AS campaignTitle, campaign.desc AS campaignDesc,
users.name AS companyName
FROM campaign
INNER JOIN users
ON campaign.userId=users.id
WHERE campaign.name like '%"Mia"%'
OR campaign.desc like '%"dolo"%'
OR users.name like '%"iT"%'
I'm newbie in doing the search function. Is there any more effective method to performs such a search? Please advise. Thanks
Update
The result returns nothing from the query above
Upvotes: 3
Views: 49
Reputation: 1254
Try:
SELECT campaign.name AS campaignTitle, campaign.desc AS campaignDesc,
users.name AS companyName
FROM campaign
INNER JOIN users
ON campaign.userId=users.id
WHERE campaign.name like '%Mia%'
OR campaign.desc like '%dolo%'
OR users.name like '%iT%'
Deleting double quotes in:
...like '%"Mia"%'
...
Upvotes: 0
Reputation: 1066
Try executing your query without where condition and you should be getting a result set as I don't find any syntax errors.
If you are getting result set, check if your where condition is getting satisfied for any of the rows in the result set.
Break down your query and go step by step to analyse further on why there is no data returned from query.
Upvotes: 1