我有一个订单有很多文章和2篇文章有相同的颜色我可以从颜色获得color_no,其中order_id是ican put我可以在查询以下执行错误显示子查询返回超过1的值。当子查询遵循=,!=,<,< =,>,> =或子查询用作表达式时,不允许这样做。我知道那里有重复记录,但我需要这些数据//选择所有颜色,在下面的查询中给出order_id如果重复没有问题显示颜色:
select color_no from color
where color_id=(select trans_id from transaction_order
where order_id=(select order_id from master_order where program_no='13-065454'))
答案 0 :(得分:2)
我认为你错了ID
where color_id=(select trans_id ......)
你试试这个
color_id=(select color_id from transaction_order where order_id=(select order_id from master_order where program_no='13-065454'))
答案 1 :(得分:1)
我猜你需要“进去”:
SELECT color_no
FROM color
WHERE color_id IN (SELECT trans_id
FROM transaction_order
WHERE order_id IN (SELECT order_id
FROM master_order
WHERE program_no = '13-065454'))