与图像一样,SQL意味着返回某个用户ID的结果,但返回另一个UID的结果。
SELECT user_games.APPID, user_games.UID, user_games.type, games_xbox.logo_small, games_other.system, games_other.logo, COALESCE( games_steam.name, games_xbox.name, games_other.name ) AS name
FROM user_games
LEFT JOIN games_steam ON user_games.APPID = games_steam.APPID
LEFT JOIN games_xbox ON user_games.APPID = games_xbox.APPID
LEFT JOIN games_other ON user_games.APPID = games_other.APPID
WHERE user_games.UID = "LAnXQshTItjyifF8f"
AND games_steam.name LIKE "%%"
OR games_xbox.name LIKE "%%"
OR games_other.name LIKE "%%"
GROUP BY user_games.APPID
答案 0 :(得分:0)
使用括号:
SELECT user_games.APPID, user_games.UID, user_games.type, games_xbox.logo_small, games_other.system, games_other.logo, COALESCE( games_steam.name, games_xbox.name, games_other.name ) AS name
FROM user_games
LEFT JOIN games_steam ON user_games.APPID = games_steam.APPID
LEFT JOIN games_xbox ON user_games.APPID = games_xbox.APPID
LEFT JOIN games_other ON user_games.APPID = games_other.APPID
WHERE user_games.UID = "LAnXQshTItjyifF8f"
AND (games_steam.name LIKE "%%"
OR games_xbox.name LIKE "%%"
OR games_other.name LIKE "%%")
GROUP BY user_games.APPID