SELECT
orders.orders_id,
orders.delivery_name,
orders.delivery_company,
orders.delivery_street_address,
orders.delivery_suburb,
orders.delivery_city,
orders.delivery_postcode,
orders.delivery_state,
orders.delivery_country,
orders. customers_telephone,
orders.shipping_method,
orders_products.products_name,
orders_products.products_model,
orders_products_attributes.products_options_values
FROM `orders_products`, `orders`,`orders_products_attributes` where orders.orders_id = orders_products.orders_id = orders_products_attributes.orders_id and orders.orders_status = 2
本人是个纯新手,这个查询老是提示错误,不晓得应该怎么写才对呢?
orders.orders_id,
orders.delivery_name,
orders.delivery_company,
orders.delivery_street_address,
orders.delivery_suburb,
orders.delivery_city,
orders.delivery_postcode,
orders.delivery_state,
orders.delivery_country,
orders. customers_telephone,
orders.shipping_method,
orders_products.products_name,
orders_products.products_model,
orders_products_attributes.products_options_values
FROM `orders_products`, `orders`,`orders_products_attributes` where orders.orders_id = orders_products.orders_id = orders_products_attributes.orders_id and orders.orders_status = 2
本人是个纯新手,这个查询老是提示错误,不晓得应该怎么写才对呢?
解决方案:4分
错误提示是什么? 贴出这样别人可以更快速的定位问题,而不需要再逐行分析LZ的语句。
解决方案:20分
SELECT orders.orders_id, orders.delivery_name, orders.delivery_company, orders.delivery_street_address, orders.delivery_suburb, orders.delivery_city, orders.delivery_postcode, orders.delivery_state, orders.delivery_country, orders. customers_telephone, orders.shipping_method, orders_products.products_name, orders_products.products_model, orders_products_attributes.products_options_values FROM `orders_products`, `orders`,`orders_products_attributes` where orders.orders_id = orders_products.orders_id and orders.orders_id = orders_products_attributes.orders_id and orders.orders_status = 2
貌似等于不能这么连着用吧。
解决方案:4分
FROM `orders_products`, `orders`,`orders_products_attributes`
where orders.orders_id = orders_products.orders_id = orders_products_attributes.orders_id and orders.orders_status = 2
红色的部分是错误的,sql语法不支持这种 a = b = c的操作,只能写出: a = b and b = c
where orders.orders_id = orders_products.orders_id = orders_products_attributes.orders_id and orders.orders_status = 2
红色的部分是错误的,sql语法不支持这种 a = b = c的操作,只能写出: a = b and b = c
解决方案:4分
的确,3楼正解,SQL语法中没有a = b = c这个语句,要表达这个意思只能用a = b and b = c
解决方案:4分
orders.orders_id = orders_products.orders_id = orders_products_attributes.orders_id
这里怎么有连续2个=号呢?
这里怎么有连续2个=号呢?
解决方案:4分
1:将错误贴出来看下
2:where 后面不支持连续等号。可以看3楼
2:where 后面不支持连续等号。可以看3楼