SELECTFROM
(SELECTFROM order_gtncoin where NOT buy_uid IN (13311787)AND NOT sale_uid IN (13319623)
UNION
SELECTFROM order_gtncoin where NOT buy_uid IN (13319623)AND NOT sale_uid IN (13311787)
UNION
SELECTFROM order_gtncoin where NOT buy_uid IN (13319623)AND NOT sale_uid IN (13319623)
UNION
SELECT*FROM order_gtncoin where NOT buy_uid IN (13311787)AND NOT sale_uid IN (13311787)
) AS a
使用UNION后达不到想要的结果
需求:查询除了13311787,13319623这两个uid相互成交和这两个uid自己和自己成交的记录
看不出是什么问题,执行和是这样
求指教,在线等挺急的。。。
select * from order_gtncoin where
(buy_uid = '13311787' and sale_uid = '13319623') or
(buy_uid = '13319623' and sale_uid = '13311787') or
(buy_uid = '13311787' and sale_uid = '13311787') or
(buy_uid = '13319623' and sale_uid = '13319623')
刚才说错了,是除了那两个账号的结果
@打我队友:
select * from order_gtncoin where not (
(buy_uid = '13311787' and sale_uid = '13319623') or
(buy_uid = '13319623' and sale_uid = '13311787') or
(buy_uid = '13311787' and sale_uid = '13311787') or
(buy_uid = '13319623' and sale_uid = '13319623') )
@会长: 谢谢老哥
SELECT
*
FROM
order_gtncoin
WHERE
id NOT IN (
SELECT
id
FROM
order_gtncoin
WHERE
(
buy_uid = 13311787
AND sale_uid = 13319623
)
OR (
buy_uid = 13319623
AND sale_uid = 13311787
)
OR (
buy_uid = 13319623
AND sale_uid = 13319623
)
OR (
buy_uid = 13311787
AND sale_uid = 13311787
)
);