mercredi 8 avril 2015

Sqlite - Count Unique Values based on Column


Vote count:

0




I've got a table like this (C, Sqlite). And I want to count the number of unique ports each IP address contacts.



id | ip_src | ip_dst | port
-----------------------------------
1 | 192.168.45.3 | ... | 442
2 | 132.43.13.4 | ... | 42
3 | 111.5.34.3 | ... | 80
4 | 54.2.2.1 | ... | 8322
5 | 54.2.2.1 | ... | 8322
6 | 192.168.45.3 | ... | 80
7 | 192.168.45.3 | ... | 23


The result of the query should ideally look something like this:



192.168.45.3 = 3
132.43.13.4 = 1
111.5.34.3 = 1
54.2.2.1 = 1


What would the query look like for this?



asked 2 mins ago

Crizly

317






Sqlite - Count Unique Values based on Column

Aucun commentaire:

Enregistrer un commentaire