I’m trying to use this query where I need to concatenate a string before compare to obtain the right results. The query is running, but is not finding any results. I believe the problem is when I try to compare “myname” in the WHERE clause. Any idea on what’s the right query for this?
SELECT *
FROM (SELECT CONCAT('tm_',name) AS myname FROM room) room, users
WHERE user_name = myname;
Why not
?