ip_available Table data is:
Similarly there are more ip_addresses with other parent values
I want result set like
DB is MySQL
Count should come for each regular sequence, No matter if parent value is repeated.
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
A little more details would help out next time, like including your table structure.
But I believe this will help you out.
SELECT MIN(ip_address) as ip_address_min, MIN(parent) as parent, COUNT(ip_address) as count FROM ip_available GROUP BY LEFT(ip_address,length(ip_address)-1);