Mysql – Query error int/varchar LEFTJOIN

mariadbMySQLPHP

Can someone tell me what´s wrong with this query?

$sql = "select 
bans.id as banid,
bans.type,
bans.data,
bans.reason,
bans.expire,
bans.added_by,
bans.added_date,
players.id as playerid,
players.username,
FROM bans 
LEFT JOIN players
ON cast(players.id as varchar(50)) = bans.added_by                       
WHERE `bans.id` LIKE '%".$amount."%' OR 
`bans.added_by` LIKE '%".$amount."%' OR 
`bans.data` LIKE '%".$amount."%' OR 
`players.username` LIKE '%".$amount."%' OR 
`bans.data` LIKE '%".$usernamevanamount."%' OR 
`bans.reason` LIKE '%".$amount."%' 
ORDER BY bans.added_date DESC"; 
$result = mysql_query($sql) or die('Error, insert query failed with:' . mysql_error());`

players.id = int

bans.added_by = varchar(50)

Error:

You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use
near 'FROM bans LEFT JOIN players ON cast(players.id as varchar(50)) =
bans.added_by ' at line 11

Best Answer

Take out the comma character before the FROM: player.username, FROM bans.