这是我的查询,它使 Join 出错
$query = 'SELECT
a.ks_u_id,
a.ks_keyword,
b.u_photo
FROM
'.T_KEYWORD_HISTORY.' a
WHERE a.ks_u_id in ( SELECT uf_target_id FROM '.T_USER_FOLLOW.' WHERE uf_user_id="'.$u_id.'" and uf_target_id <> "'.$u_id.'" )
JOIN '.T_USER_ACCOUNT.' b ON b.u_id = a.ks_u_id
ORDER BY a.ks_time DESC
LIMIT 0 , 5 ';
我收到此错误消息。
您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以'JOIN T_USER_ACCOUNT b ON b.u_id = a.ks_u_id ORDER BY a.ks_time DESC '
在第 8 行附近使用正确的语法
SELECT
a.ks_u_id, a.ks_keyword, b.u_photo
FROM T_KEYWORD_HISTORY a
WHERE a.ks_u_id in ( SELECT uf_target_id
FROM T_USER_FOLLOW
WHERE uf_user_id="jake" and uf_target_id <> "jake" )
JOIN T_USER_ACCOUNT b ON b.u_id = a.ks_u_id
ORDER BY a.ks_time DESC
LIMIT 0 , 5
看起来我为 JOIN 命令编写了错误的查询。