工做日誌 ,城市ip地址整理

INSERT  INTO s


SELECT a.city,b.startip,b.endip FROM cityinfo a  JOIN t_ip  b
ON b.cheng LIKE  CONCAT("%" ,a.city ,"%")
ORDER BY a.city



HAVING COUNT(a.city)<=5
ORDER BY a.city


GROUP BY a.city

 SELECT INET_NTOA(1232307786) AS ip;

--------------------------------------
DELETE FROM s

----------------
INSERT  INTO s

SELECT a.city,b.startip,'' FROM cityinfo a  JOIN t_ip  b
ON b.cheng LIKE  CONCAT("%" ,a.city ,"%")
GROUP BY a.city,b.startip
HAVING COUNT(b.startip)<=5

ORDER BY a.city
--------------------------------------------------------
SELECT  * FROM cityinfo a
WHERE (SELECT COUNT(*) FROM s b WHERE  b.city=a.city  )<5
 ORDER BY a.city




SELECT COUNT(1) FROM cityinfo;
SELECT * FROM t_ip

SELECT city,startip,endip FROM  s 
 UNION 

SELECT city,startip FROM  s 
GROUP BY city,startip
HAVING COUNT(startip)<2 LIMIT 5


SELECT * FROM s a  WHERE EXISTS
(SELECT COUNT(*) FROM s b WHERE b.city=a.city AND a.id>b.id  HAVING COUNT(*)<6)
ORDER BY a.city,a.startip DESC

INSERT  INTO m
SELECT a.city,a.startip FROM s a  WHERE 5>
(SELECT COUNT(*) FROM s b WHERE b.city=a.city AND b.id<a.id)
ORDER BY a.city,a.startip DESC


SELECT COUNT(0) FROM (

SELECT DISTINCT city FROM m ) a


SELECT city,startip,CONCAT(SPLIT_STR(startip,'.',1),'.',SPLIT_STR(startip,'.',2),'.',SPLIT_STR(startip,'.',3)) FROM m 

WHERE SPLIT_STR(startip,'.',4) !='0'

SELECT SPLIT_STR('a|bb|ccc|dd', '|', 3) AS third;

SELECT * FROM t_ip WHERE startip='211.98.31.112'
相關文章
相關標籤/搜索