我的sql 语句in,为什么用不了啊?
SELECT `products`.product_model, sum( quantity ) AS sum_total, `product_descriptions`.product_name
FROM order_products, product_descriptions, products
WHERE `order_products`.product_id = `products`.product_id
AND `product_descriptions`.product_id = `products`.product_id
AND `products`.order_id
IN (
SELECT `orders`.order_id
FROM `orders`
WHERE date_created
BETWEEN '2009-01-01'
AND '2012-01-01'
)
GROUP BY `products`.product_id
LIMIT 0 , 30
然后提示#1054 - Unknown column 'products.order_id' in 'IN/ALL/ANY subquery'
给点指点!!!
------解决方案--------------------
products表中有order_id这个字段吗?
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号