2011-07-15 74 views
0

我有一張如下所示的表格Mysql數據跳轉檢查

MAC地址| ACCESSPOINT | TIMESTAMP

數據以15分鐘間隔由所有訪問點推入表中。

我想運行一個查詢來告訴我在一個給定的範圍內出現在多個Accesspoint上的MAC地址?

回答

-1

選擇MAC,計數(不同的名稱)作爲OCC從

(從maclist 選擇macname哪裏2011-07-08 00:00之間」 datim: 00「和」2011-07-14 23:59:59「 按名稱排序,mac按排序順序排列)

作爲tmo分組由mac具有occ> 1;

這爲我工作

0

嘗試類似...

select mac 
where datim between firstdate and lastdate 
group by mac 
having count(*) > 1 

- 刪除多餘的ACC格式組... JK

+0

這似乎不正確恕我直言,只需要在Mac分組,無法在Mac,累計。 – DhruvPathak

+0

正確...謝謝 –

0

的查詢是這樣的:

Select `MAC_ADDRESS`,`ACCESSPOINT`,`TIMESTAMP`,count(*) as occurences from 
theTable where occurences > 1 and `TIMSTAMP` between TIME1 and TIME2 
group by `MAC_ADDRESS` order by occurences desc ; 

這將使你在相同的接入點上,最重複的MAC地址後跟較少的MAC地址列表。

0

試試這個:

SELECT `MAC-ADDRESS` 
    FROM mytable 
    WHERE `TIMESTAMP` BETWEEN <YOUR-TIMESTAMP-1> AND <YOUR-TIMESTAMP-2> 
    GROUP BY `ACCESSPOINT` 
    HAVING COUNT(1) > 1 
0
SELECT mac_address 
    , COUNT(DISTINCT accesspoint) AS occurences 
FROM maclist 
WHERE `timestamp` BETWEEN @StartTimestamp AND @EndTimestamp 
GROUP BY mac_address 
HAVING COUNT(DISTINCT accesspoint) > 1