求SQL语句,谢谢!
表A:
peono peoname cardno opertype handletime
00296584张三100328申请用户卡2007-08-22 15:37:35.607
00296584张三000566换卡 2007-08-23 09:05:29.187
00083144李四052314申请用户卡2007-08-22 15:27:20.000
00083144李四052314换卡 2007-08-23 10:11:26.530
00296013王五021108申请用户卡2007-08-22 15:50:10.547
00296013王五021108换卡 2007-08-23 10:56:23.390
00053973张飞119922申请用户卡2007-08-23 08:52:07.340
00053973张飞105603换卡 2007-08-23 09:04:20.263
......
如何买语句查询如下结果,申请用户卡与换卡卡号不一致的peono:
-------------
peono
00296584
00053973
[解决办法]
select
distinct m.peono
from
表A m,表A n
where
m.peono=n.peono
and
m.opertype= '申请用户卡 '
and
n.opertype= '换卡 '
and
m.cardno <> n.cardno