select a.* from customers a inner join orders b on a.cust_id=b.cust_id inner join order times c on b.order_num=c.cust_id where c.prod_id='int2'
用join来代替子查询吧,像楼上写的这样;
MYSQL并不支持数组或集合变量,所以无法象C语言一样用变量实现你的这个功能。当然如果你的几个子查询的返回都是唯一值,则可以用变量。比如 select order_num into @order_num from orderitems where prod_id='INT2';select * from .... where order_num=@order_num ;
inner join order times c on b.order_num=c.cust_id where c.prod_id='int2'