作者misssun (我要炸掉了)
看板Database
标题[SQL ] 如何选出count(*)=1 的资料?
时间Wed Aug 15 14:26:12 2007
先说明一下我的资料:
TABLE:AA
customerid againid
110 1
120 2
135 1
135 2
144 1
144 1
144 2
144 2
156 1
156 2
156 2
红色字体是我最後想要筛选出来的资料,
我的SQL如下:
select customerid,againid,count(customerid)
from AA
where (时间区间)
group by customerid,againid
having count(customerid) = 1
但是最後总会连紫色字体的资料也被筛选出来
请问各位,我该如何更改语法,才能选取到我所需要的资料呢?!
先谢谢愿意回答我的人罗~~~~
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 210.202.218.61
※ 编辑: misssun 来自: 210.202.218.61 (08/15 14:30)
※ 编辑: misssun 来自: 210.202.218.61 (08/15 16:28)