473,383 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

GROUP BY IP Address Range

I store IP addresses using the INET_ATON function, e.g.

INSERT INTO myTable(IP_Address) Values (INET_ATON(123.123.33.12));

I would like to create a daily report that groups IP addresses by a "dotted
triad", e.g.

(pseudo SQL) SELECT myTable.IP_Address FROM myTable GROUP BY
123.123.33.*;

Any ideas on the best way to go about this?

Thanks for your help!

--Brent
Jul 20 '05 #1
3 5745
"Brent" wrote:
I store IP addresses using the INET_ATON function, e.g.

INSERT INTO myTable(IP_Address) Values
(INET_ATON(123.123.33.12));

I would like to create a daily report that groups IP addresses by a
"dotted
triad", e.g.

(pseudo SQL) SELECT myTable.IP_Address FROM myTable GROUP BY
123.123.33.*;

Any ideas on the best way to go about this?

Thanks for your help!

--Brent


What is INET_ATON?

If you want to do serious IP range reporting, then I suggest to split
up the ip into its 4 components, and then save each of the 4
components to a single field in your db. So ’123.111.98.11" would
be saved as:
123 , 111, 98, 11

--
http://www.dbForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/mySQL-GROUP-...ict132947.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=443943
Jul 20 '05 #2
Not sure whether you need GROUP BY or ORDER BY, but to get the "dotted
triad", you can use the following expression:

LEFT(IP_Address , LENGT(IP_Address) - LOCATE('.', REVERSE(IP_Address)))
"Brent" <bbigler @ ahem-'whoopee' . com> wrote in message
news:aw*******************@newssvr29.news.prodigy. com...
I store IP addresses using the INET_ATON function, e.g.

INSERT INTO myTable(IP_Address) Values (INET_ATON(123.123.33.12));

I would like to create a daily report that groups IP addresses by a "dotted triad", e.g.

(pseudo SQL) SELECT myTable.IP_Address FROM myTable GROUP BY
123.123.33.*;

Any ideas on the best way to go about this?

Thanks for your help!

--Brent


Jul 20 '05 #3
Not sure whether you need GROUP BY or ORDER BY, but to get the "dotted
triad", you can use the following expression:

LEFT(IP_Address , LENGT(IP_Address) - LOCATE('.', REVERSE(IP_Address)))
"Brent" <bbigler @ ahem-'whoopee' . com> wrote in message
news:aw*******************@newssvr29.news.prodigy. com...
I store IP addresses using the INET_ATON function, e.g.

INSERT INTO myTable(IP_Address) Values (INET_ATON(123.123.33.12));

I would like to create a daily report that groups IP addresses by a "dotted triad", e.g.

(pseudo SQL) SELECT myTable.IP_Address FROM myTable GROUP BY
123.123.33.*;

Any ideas on the best way to go about this?

Thanks for your help!

--Brent


Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Brent | last post by:
I store IP addresses using the INET_ATON function, e.g. INSERT INTO myTable(IP_Address) Values (INET_ATON(123.123.33.12)); I would like to create a daily report that groups IP addresses by a...
21
by: Stephen Biggs | last post by:
Given this code: void f(void){} int main(void){return (int)f+5;} Is there anything wrong with this in terms of the standards? Is this legal C code? One compiler I'm working with compiles this...
9
by: Terry E Dow | last post by:
Howdy, I am having trouble with the objectCategory=group member.Count attribute. I get one of three counts, a number between 1-999, no member (does not contain member property), or 0. Using...
4
by: richard.mcgrath | last post by:
Hi, I have to restrict access to a site based on IP address. While I have been able to this successfully with code in the Global.aspx file, some if the IP address are not single IP addresses...
9
by: harborboy76 | last post by:
Hi, I have a problem with one of my view. Basically, I need to create a view to sum the amount in Table A grouped by the EMPLOYEE_ID. But I also need the ability to limit the date range. What...
10
by: Chris | last post by:
I am using an access database and have range of years for customers and want to group them together. for example: 1990 1991 1992 1993 1994 1998
3
by: Shyckymn | last post by:
Dudes, How can I make a GROUP BY function into an SQL instruction, to count how much machines by ip address range (until the 3rd range)? Ex: (Existent registers for a field called ip_addr) ...
14
by: NetworkElf | last post by:
Hi all, Does anyone have some code that shows an example of how to loop through a range of IP addresses? I'm using text boxes to get a start and end value for the range. I was thinking about...
3
by: Smokey Grindel | last post by:
Is there a way to check if an IP address is in a subnet range? say I have the IP 10.10.0.0 and a subnet of 255.255.0.0 and am given the IP 10.10.50.1 and want to verify that it is in that...
36
by: Julienne Walker | last post by:
Ignoring implementation details and strictly following the C99 standard in terms of semantics, is there anything fundamentally flawed with describing the use of a (non-inline) function as an...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.