实际上,我认为应该没问题,但事实并非如此
SELECT animize_users.username, animize_profile.avatar
FROM animize_users, animize_profile
WHERE `animize_profile.userid` = 1 AND `animize_users.id` = 1
LIMIT 0 , 1
请不要告诉我把它放在一个单独的查询中 - 因为我不想打不必要的电话......
实际上,我认为应该没问题,但事实并非如此
SELECT animize_users.username, animize_profile.avatar
FROM animize_users, animize_profile
WHERE `animize_profile.userid` = 1 AND `animize_users.id` = 1
LIMIT 0 , 1
请不要告诉我把它放在一个单独的查询中 - 因为我不想打不必要的电话......
如果不需要,只需完全删除引号,即
SELECT animize_users.username, animize_profile.avatar FROM animize_users au join animize_profile ap on ap.userid = au.id WHERE au.id = 1
如果您对用户 ID 进行了正确的 PK,则用户不应重复,并且真正限制 1 只会影响您对个人资料的选择。我建议添加到 where 以确保您获得最合适的个人资料。
此外,如果“动画化”是您的产品,请不要在表格前加上它,这是多余的。
在正确使用反引号的情况下尝试这种方式:
SELECT animize_users.username, animize_profile.avatar
FROM animize_users, animize_profile
WHERE `animize_profile`.`userid` = 1 AND `animize_users`.`id` = 1
LIMIT 0 , 1