use saidao_main SELECT COUNT(1) FROM TBKCustomerConfig WHERE FIsVALID = 1 ALTER TABLE TBKCustomerConfig ADD FCompanys INT NOT NULL DEFAULT 0 UPDATE TBKCustomerConfig SET FIsVALID = 0 SELECT count(1),sum(FCompanys) FROM TBKCustomerConfig WHERE FIsValid = 1 SELECT * FROM TBKCustomerConfig SELECT cityName,custId,custName,left(url,CharIndex('/',url) - 1)as url,right(url,len(url) - CharIndex('/',url))as db,name,password FROM ( SELECT cityName,custId,custName, replace(replace(url,'jdbc:jtds:sqlserver://',''),':',',') as url,name,password FROM TBKCustomerConfig WHERE FIsValid = 1 AND (attribution like '%云南%' OR cityName LIKE '%昆明%' OR cityName LIKE '%曲靖%' OR cityName LIKE '%玉溪%' OR cityName LIKE '%保山%' OR cityName LIKE '%昭通%' OR cityName LIKE '%丽江%' OR cityName LIKE '%普洱%' OR cityName LIKE '%临沧%' OR cityName LIKE '%楚雄%' OR cityName LIKE '%红河%' OR cityName LIKE '%文山%' OR cityName LIKE '%西双版纳%' OR cityName LIKE '%大理%' OR cityName LIKE '%德宏%' OR cityName LIKE '%怒江%' OR cityName LIKE '%迪庆%' ) ) AS T ORDER BY cityName SELECT cityName,custId,custName,left(url,CharIndex('/',url) - 1)as url,right(url,len(url) - CharIndex('/',url))as db,name,password FROM ( SELECT cityName,custId,custName, replace(replace(url,'jdbc:jtds:sqlserver://',''),':',',') as url,name,password FROM TBKCustomerConfig WHERE FIsValid = 1 AND (attribution like '%山东%' OR cityName LIKE '%青岛%' OR cityName LIKE '%济南%' OR cityName LIKE '%威海%' OR cityName LIKE '%淄博%' OR cityName LIKE '%日照%' OR cityName LIKE '%烟台%' OR cityName LIKE '%诸城%' OR cityName LIKE '%郓城%' OR cityName LIKE '%聊城%' OR cityName LIKE '%菏泽%' OR cityName LIKE '%滨州%' OR cityName LIKE '%枣庄%' OR cityName LIKE '%济宁%' OR cityName LIKE '%东营%' OR cityName LIKE '%潍坊%' OR cityName LIKE '%泰安%' OR cityName LIKE '%莱芜%' OR cityName LIKE '%临沂%' OR cityName LIKE '%德州%' ) ) AS T ORDER BY cityName SELECT cityName,custId,custName,left(url,CharIndex('/',url) - 1)as url,right(url,len(url) - CharIndex('/',url))as db,name,password SELECT attribution ,SUM(1) FROM ( SELECT attribution,cityName,custId,custName, replace(replace(url,'jdbc:jtds:sqlserver://',''),':',',') as url,name,password FROM TBKCustomerConfig WHERE FIsValid = 1 ) AS A GROUP BY attribution ORDER BY SUM(1) DESC select * from TClientInfo WHERE FProvince = ''