Shawn V
Shawn V

Reputation: 127

using concat in where like query

First off, I'm a beginner at this so please be patient with me. I've tried searching the forums here, and elsewhere and from what I can see I'm doing it right.. but I get an error. to "Check syntax to use near 'LIKE CONCAT(games.tag, ' Special%') AT LINE X". So clearly I'm doing it wrong.. But everything I have found says I've done it right. Someone please help I'm getting frustrated.

SELECT
games.tag,
ribbons.name,
members.username,
members.joined
FROM
member_ribbons
INNER JOIN ribbons
 ON member_ribbons.ribbon_id = ribbons.id
INNER JOIN games
 ON ribbons.game_id = games.id
INNER JOIN members
 ON member_ribbons.member_id = members.id
WHERE games.id = members.primary_game AND discharged='000-00-00' AND ribbons.name = LIKE CONCAT(games.tag, ' Special %');

An Example ribbons.name will contain "BF4 Special Consideration"

I need to be able to find that specific one.. but the only thing that changes is the first word which is contained in games.tag. The rest of the Query works. Just need to figure out how to get it to do this and I'm good. However Searching google everywhere and here has not shown any examples of how to do this.. Is it even possible? Clearly I'm doing this wrong.

Upvotes: 3

Views: 81

Answers (1)

echo_Me
echo_Me

Reputation: 37233

you have extra =

change this

  AND ribbons.name = LIKE CONCAT
                   ^----//--no need this

to

  AND ribbons.name LIKE CONCAT

Upvotes: 4

Related Questions