此查询仅返回一个结果,应返回两个结果

时间:2013-12-05 18:32:57

标签: mysql sql

这个查询应该返回两个ord​​er_ids ..但只返回一个,order_ids符合查询条件......可能出错?

SELECT r.*
FROM products_to_products_extra_fields AS p
INNER JOIN orders_roster AS r ON p.products_id = r.products_id
INNER JOIN orders AS o on r.orders_id = o.orders_id
WHERE p.products_extra_fields_id = 14 AND
     p.products_extra_fields_value between '2013-11-01' and '2013-11-30 23:59:59' AND
     r.roster_status != 'Removed' AND
     o.payment_method = 'Institutional Billing' AND
     o.orders_status < 100001
GROUP BY o.orders_id
ORDER BY DECODE(o.cc_type, 'oFsAfHr7') ASC

1 个答案:

答案 0 :(得分:0)

尝试:

SELECT DISTINCTROW r.* ...

另外,试用GROUP BY子句,这可能导致行在orders_id上崩溃。