select * from tk_in00 where exists (select shop_id,alt_id from tk_inalert00 where tk_in00.shop_id=tk_inalert00.shop_id and tk_in00.in_id=tk_inalert00.alt_id)
上面已经查询出了tk_inalert00与tk_in00 中已经插入的数据
怎么查询出 未插入的数据记录select * from tk_in00 where not exists (select shop_id,alt_id from tk_inalert00 where tk_in00.shop_id=tk_inalert00.shop_id and tk_in00.in_id=tk_inalert00.alt_id)
exists
改成not exists不就可以了么 SQL code: select * from tk_inalert00 where not exists (select shop_id,alt_id from tk_in00 where tk_in00.shop_id=tk_inalert00.shop_id and tk_in00.in_id=tk_inalert00.alt_id)
select o_customer,o_price from orders having o_price >=avg(o_price) select o_customer,o_price from orders where o_price >=(select avg(o_price) from orders) 我感觉没有区别啊,怎么在mysql会有 ......