伙计们正在寻求一些帮助。我试图在php myadmin中运行此查询。需要更新具有4组数据的临时表。来自一个表的3个集合和来自另一个表的1个集合,同时连接3个表格。在我的第二次JOIN之后,我没有唯一的表别名,这个错误就会出现。我不知道如何解决这个问题。任何人都可以看到查询出错的地方?感谢。
INSERT INTO jos_jxgallery_assign_ratings_temp( image_id, pscore, hits, contest_id )
SELECT jos_jxgallery_images.image_id, jos_jxgallery_images.pscore, jos_jxgallery_images.hits, jos_jxgallery_contests.contest_id
FROM jos_jxgallery_images, jos_jxgallery_contests
INNER JOIN jos_jxgallery_contest_image_map ON jos_jxgallery_images.image_id = jos_jxgallery_contest_image_map.image_id
INNER JOIN jos_jxgallery_contests ON jos_jxgallery_contest_image_map.contest_id = jos_jxgallery_contests.contest_id
WHERE jos_jxgallery_contests.published =1
AND jos_jxgallery_images.published =1
ORDER BY jos_jxgallery_images.pscore DESC , jos_jxgallery_images.hits DESC
LIMIT 25
MySQL said: Documentation
#1066 - Not unique table/alias: 'jos_jxgallery_contests'
现在,当我将查询更改为此...时,查询下方会出现另一个错误。有什么想法吗?
INSERT INTO jos_jxgallery_assign_ratings_temp( image_id, pscore, hits, contest_id )
SELECT jos_jxgallery_images.image_id, jos_jxgallery_images.pscore, jos_jxgallery_images.hits, jos_jxgallery_contests.contest_id
FROM jos_jxgallery_images, jos_jxgallery_contests
INNER JOIN jos_jxgallery_contest_image_map ON jos_jxgallery_images.image_id = jos_jxgallery_contest_image_map.image_id
INNER JOIN jos_jxgallery_contests AS con ON jos_jxgallery_contest_image_map.contest_id = con.contest_id
WHERE con.published =1
AND jos_jxgallery_images.published =1
ORDER BY jos_jxgallery_images.pscore DESC , jos_jxgallery_images.hits DESC
LIMIT 25
MySQL said: Documentation
#1054 - Unknown column 'jos_jxgallery_images.image_id' in 'on clause'
答案 0 :(得分:0)
您使用FROM和INNER JOIN中的jos_jxgallery_contests。在INNER JOIN中,您建立了一个模糊的连接。你为什么要这样做?