OniLink wrote:SELECT player_id, CONCAT(first_name, " ", last_name) AS name, photo FROM players WHERE grade != "" AND name LIKE "%'.$keyword.'%" ORDER BY last_name, first_name ASC';
I'm now getting an error:
"MySQL Error: Unknown column name in where clause"
Why would that be? Am I not allowed to use "name" in the where clause?
Aliases are often not resolved yet when the where clause is evaluated. I guess you could do:
SELECT player_id, CONCAT(first_name, " ", last_name) AS name, photo
FROM players
WHERE grade != "" AND CONCAT(first_name, " ", last_name) LIKE "%'.$keyword.'%"
ORDER BY last_name, first_name ASC';