MySQL:不是唯一的表/别名:“产品" [英] MySQL: Not unique table/alias: 'product'

查看:57
本文介绍了MySQL:不是唯一的表/别名:“产品"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建 SQL 查询来选择图像列,其中 product_id 来自 2 个不同的表.

I am trying to build SQL query to select image column, where product_id is coming from 2 different table.

这是我的数据库架构:

我想从 ixml_prd_map.id_oc_prd 中选择产品图片.我需要从这里到达 product_image.image.

I want to select images of products from ixml_prd_map.id_oc_prd. I need to get from here to product_image.image.

在图片上你可以看到我正在尝试做什么,这是我目前所做的,但它不起作用.错误:

On the picture you can see what I am trying to do, here is what I done so far, but it's not working. The error:

Not unique table/alias: 'product'


SELECT product_image.image FROM (product INNER JOIN ixml_prd_map ON product.sku = ixml_prd_map.id_oc_prd) INNER JOIN product ON product_image.product_id = product.product_id

推荐答案

你必须用 product_image

SELECT 
product_image.image 
FROM product 
INNER JOIN ixml_prd_map ON product.sku = ixml_prd_map.id_oc_prd
INNER JOIN product_image ON product_image.product_id = product.product_id

这篇关于MySQL:不是唯一的表/别名:“产品"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆