随笔分类 -  SQL

摘要:SELECT STUFF( (SELECT Distinct '|'+ProductCode FROM [chexian].[dbo].[ProxyServer] WHERE CompanyID=1069 FOR XML PATH('') ),1,1,'') 阅读全文
posted @ 2016-08-15 16:01 会弹猫的吉他 阅读(679) 评论(0) 推荐(0)
摘要:select * from [ProxyServer] where [CompanyID] in (select [CompanyID] from [ProxyServer] group by [CompanyID] having count(*)>1) 阅读全文
posted @ 2016-08-01 10:47 会弹猫的吉他 阅读(413) 评论(0) 推荐(0)
摘要:select T.*,P.ProductName from (select V.CompanyID,C.CompanyName,V.ProductCode from VehicleInsuranceAgentConfiguration V inner join Company C on V.CompanyID = C.CompanyID where V.IsDelete=0 and V.Ho... 阅读全文
posted @ 2016-07-18 16:27 会弹猫的吉他 阅读(160) 评论(0) 推荐(0)
摘要:1: SELECT TOP 1 P.* FROM [ProxyServer] P JOIN (SELECT RAND()*100 AS Nid) T ON P.[Id]>T.Nid WHERE P.Cookie'' and P.CompanyID=1069 and P.ProductCode='TPCX'2: SELECT TOP 1 * FROM [ProxyServer] WHE... 阅读全文
posted @ 2016-07-18 16:23 会弹猫的吉他 阅读(264) 评论(0) 推荐(0)
摘要://查询一个表中的某字段为条件修改另一个表的内容 update [VehicleInsuranceAgentConfiguration] set Keyword2=PC.ServerConfig from ProxyConfig PC,VehicleInsuranceAgentConfiguration VIAC where VIAC.CompanyID=PC.CompanyID and VI... 阅读全文
posted @ 2016-07-11 10:11 会弹猫的吉他 阅读(167) 评论(0) 推荐(0)
摘要:多线程处理sql server2008某个表中的数据时,在Update记录的时候出现了【Transaction (Process ID 146) was deadlocked on lock resources with another process and has been chosen as 阅读全文
posted @ 2016-07-07 15:38 会弹猫的吉他 阅读(8224) 评论(0) 推荐(0)
摘要:UPDATE 表名 SET 字段名 = REPLACE (字段名, 'old', 'new'); 阅读全文
posted @ 2016-07-06 12:54 会弹猫的吉他 阅读(1036) 评论(0) 推荐(0)