Home > Backend Development > PHP Tutorial > 小弟我的sql 语句in,为什么用不了啊

小弟我的sql 语句in,为什么用不了啊

WBOY
Release: 2016-06-13 13:39:00
Original
990 people have browsed it

我的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这个字段吗?

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template