йڸ ڸ
ex1) . йڸ 3 ڸ
mysql> select substring_index('192.168.1.111','.',3);
+----------------------------------------+
| substring_index('192.168.1.111','.',3) |
+----------------------------------------+
| 192.168.1 |
+----------------------------------------+
1 row in set (0.01 sec)
ex2)
select substring_index(nic_ip,'.',3) as ip_class from TB_TEST where isused='0' group by ip_class order by INET_ATON(nic_ip);
+------------+
| ip_class |
+------------+
| 192.168.20 |
| 192.168.21 |
| 192.168.22 |
| 192.168.23 |
| 192.168.24 |
| 192.168.25 |
| 192.168.27 |
| 192.168.29 |
| 192.168.30 |
| 192.168.74 |
| 192.168.108 |
| 192.168.141 |
| 192.168.181 |
| 192.168.182 |
+------------+
14 rows in set (0.05 sec)