473,383 Members | 1,866 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.

How to create a GROUP BY for use with ip address range?

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)

172.17.17.1
172.17.17.2
172.17.17.3
172.18.196.12
172.18.196.22
172.22.3.1

Range 172.17.17: 3 machines
Range 172.18.196: 2 machines
Range 172.22.3: 1 machine
Mar 14 '07 #1
3 1945
poddus
2
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)

172.17.17.1
172.17.17.2
172.17.17.3
172.18.196.12
172.18.196.22
172.22.3.1

Range 172.17.17: 3 machines
Range 172.18.196: 2 machines
Range 172.22.3: 1 machine
You can (in ver.8) group by
SUBSTR(ip_addr,1,
LOCATE('.',ip_addr,
LOCATE('.',ip_addr,LOCATE('.',ip_addr)+1)+1)-1)
because
SELECT SUBSTR('172.18.196.12',1,
LOCATE('.','172.18.196.12',
LOCATE('.','172.18.196.12',LOCATE('.','172.18.196. 12')+1)+1)-1)
FROM SYSIBM.SYSDUMMY1
is 172.18.196

regards,
poddus
Mar 15 '07 #2
poddus
2
you can (in ver.8) group by
SUBSTR(ip_addr,1,
LOCATE('.',ip_addr,
LOCATE('.',ip_addr,LOCATE('.',ip_addr)+1)+1)-1)
becase FROM SYSIBM.SYSDUMMY1
SELECT SUBSTR('172.18.196.12',1,
LOCATE('.','172.18.196.12',
LOCATE('.','172.18.196.12',LOCATE('.','172.18.196. 12')+1)+1)-1)
from sysibm.sysdummy1 is 172.18.196
regards,
poddus
Mar 15 '07 #3
Ok, thanks a lot!
Mar 16 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: xxbmichae1 | last post by:
I am writing a function that will create different type of input ranges, example one function that will create date range inputs with drop down calendars, another will be for currency ranges,...
7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
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...
2
by: Mikey | last post by:
Sample VB .NET source code to create mailing labels or customized letters using MS Word MailMerge This VB .NET source code will start MS Word and call methods and set properties in MS Word to...
4
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is...
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: creative1 | last post by:
Here is how you create a complex data report that involves parent and child commands and you can update information at runtime. Its pretty straight forward to work with simple queries; however,...
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...
3
by: brat33 | last post by:
I am trying to use a command button to automate a process for creating mailing labels from a query in Access 2007, going into word 2007. Current code looks like the following: 'Start MS Word Dim...
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: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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.