we have a table like this
ip, class
192.168.1.1, 192.168.1
192.168.1.3, 192.168.1
12.34.56.78, 12.34.56
12.34.56.11, 12.34.56
12.34.56.16, 12.34.56
...
...
we need a query to select only X ips from the same class in a query. Eg, we need to select all the ips but max 2 ips from the same class.
We tried using temporary tables but we didn't had any luck. We need it to be able to do it from mysql only