mysql> SELECT * FROM users WHERE find_in_set(
'2'
, limits);
sqlserver: url:http://bbs.csdn.net/topics/110118170
select * from [tbServerWeb]. [dbo].[tb_gameStaff] where PATINDEX('%130601%' ,[g_partnerNo])> 0 and UserID=10043;
select * from [tbServerWeb]. [dbo].[tb_gameStaff] where charindex('130601' ,[g_partnerNo])> 0 and UserID=10043;
-*****************************************************************************************************************************-
字段判空:
Sqlserver:
SELECT TOP 1000 icon ,*
FROM [userapp].[dbo] .[tbiTunesNewApp]
i left join userapp. dbo.tbUserApp u on i .appid= u.id
where i.isActive =1 and len( u.icon )<1 order by seq desc
-*****************************************************************************************************************************-
Char(32)类型的数字不能按数值来进行比较:
eg:
130699 和 1306167:
(int)130699 < (int)1306167 按数值大小比较
(Char)130699 > (Char)1306167 按字符从左到右依次比较
-*****************************************************************************************************************************-
查询语句做除法 保留几位小数
Serversql: SELECT ROUND(COALESCE(CAST([curTimes] AS FLOAT), 0)/1000, 3) a FROM [iMessage].[dbo].[tbmaclist]
mysql:
SELECT
TRUNCATE
(7185521/7185522,4)
------------------------------------------------------
获取insert的id
SELECT @@IDENTITY;
---------------------------
mysql:
SELECT LAST_INSERT_ID();