Distinct 去重复。性能上和 GROUP BY 差异据说有点点优势,GROUP BY 存在毕竟不是用来去重的,GROUP BY 用作分组,当然可以做去重动作
select DISTINCT [列1],[列2]... from [数据库].[dbo].[表名]
CHARINDEX
charindex 取指定字符在字符串中的位置
SELECT CHARINDEX("ab","123456abcde");
// 结合表
SELECT CHARINDEX("ab",[列名]) as [abIndex],[列名] from [数据库].[dbo].[数据表] ;
SUBSTRING
Substring 截取字符
SELECT DISTINCT LTRIM(RTRIM(LOWER(SUBSTRING([列 0],0,CHARINDEX(":$",[列 0]))))) as [email], [列 0] as [txt]
FROM [Ve_Old].[dbo].[bf_1]