I am using one database in mysql in which it is having a record of sources:
IP (sip)
Destination IP (dip)
Source Port (sport)
Destination Port (dport)
When doing select query
select count(sport) as port, sport from IPtable limit 20);
the result is as follows:
port sport
3 80
5 8080
15 21
3 20
25 443
16 1234
49 2352
15 2353
I want to group these ports like
web (80, 8080, 443)
ftp (20, 21)
chat (2352, 2353)
others("rest other ports")
and want output result as
count port
=============
33 web
18 ftp
16 application
64 others
Please help because I want to create pi chart from this output.