473,806 Members | 2,845 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

5 New Member
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 1955
poddus
2 New Member
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_a ddr,
LOCATE('.',ip_a ddr,LOCATE('.', ip_addr)+1)+1)-1)
because
SELECT SUBSTR('172.18. 196.12',1,
LOCATE('.','172 .18.196.12',
LOCATE('.','172 .18.196.12',LOC ATE('.','172.18 .196.12')+1)+1)-1)
FROM SYSIBM.SYSDUMMY 1
is 172.18.196

regards,
poddus
Mar 15 '07 #2
poddus
2 New Member
you can (in ver.8) group by
SUBSTR(ip_addr, 1,
LOCATE('.',ip_a ddr,
LOCATE('.',ip_a ddr,LOCATE('.', ip_addr)+1)+1)-1)
becase FROM SYSIBM.SYSDUMMY 1
SELECT SUBSTR('172.18. 196.12',1,
LOCATE('.','172 .18.196.12',
LOCATE('.','172 .18.196.12',LOC ATE('.','172.18 .196.12')+1)+1)-1)
from sysibm.sysdummy 1 is 172.18.196
regards,
poddus
Mar 15 '07 #3
Shyckymn
5 New Member
Ok, thanks a lot!
Mar 16 '07 #4

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

Similar topics

2
1766
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, another for uppercase input, etc.... anyway, the drop down calendar I am using has a javascript you call after the html of your edit box and object to click on to drop the calendar....is there a way or is it correct to say, that if you use innerHtml...
7
8876
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 want my users to be able to select a report, click on a command button on a form, which will then automatically create the report as a pdf file and save it to the user's machine. I am using Adobe Acrobat (5.0 I think) and have Adobe Distiller as a
9
10851
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 LDIFDE as a comparison I get the same results. No members means just that, an empty group. Zero means that the DirectorySearcher.SizeLimit has been exceeded....
2
13537
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 execute a MailMerge to create mailing labels or customized letters. A label name known to MS Word MailMerge mailing label wizard may be used or a template file containing the field names Line1 thru Line5 for each record to be printed. If a...
4
12454
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 this: can Access create the document and place it as an OLE object to the relevant table? Any help is greatly appreciated. Ricky
14
6023
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 using 4 nested for-next loops, but I seem to be having trouble working out the logic to validate the octets in the beginning and ending address so the range works correctly. i.e. 172.16.1.1/172.20.1.1 should loop 172-172,16-20,1-254,1-254...
3
18722
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, working with complex reports is tricky Assumption: Reader of this article have basic knowledge of creating data reports. Creating a Parent-Child Command and create a DataReport Suppose we have a database called company with two tables ...
36
3406
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 address? I keep feeling like I'm missing something obvious. -Jul To keep things in context, this is in reference to describing functions to a beginner.
3
5009
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 objWord As Word.Application Set objWord = CreateObject("Word.Application") 'Make Application visible With objWord .Visible = True ActiveDocument.MailMerge.MainDocumentType = wdMailingLabels
0
9719
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10110
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9187
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7649
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4329
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3850
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.