如何按照字符号串的后几位排序 难 select * from tb order by substring(t1 , charindex('@',t1) + 1, charindex('.',t1) - charindex('@',t1) -1) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 declare @t table(t1 varchar(20))insert @t select '[email protected]'union all select '[email protected]'union all select '[email protected]'union all select '[email protected]'union all select '[email protected]'select t1 from @t order by substring(t1 , charindex('@',t1) + 1, charindex('.',t1) - charindex('@',t1) -1) t1 -------------------- [email protected][email protected][email protected][email protected][email protected](所影响的行数为 5 行) declare @t table(t1 varchar(20))insert @t select '[email protected]'union all select '[email protected]'union all select '[email protected]'union all select '[email protected]'union all select '[email protected]'select t1 from @t order by reverse(t1) 这个简洁一点,呵呵select t1 from table1order by right(t1,len(t1)-charindex('@',t1)+1) 大家帮我看个SQL2008字符串转换时间问题。执行提示从字符串转换日期和/或时间时,转换失败。在线等啊! 两亿条记录会有什么后果,没分了,会追加 小问题 Companyname varchar(20) NOT NULL,請教! 关于行列转换的 非主键唯一性(单据号生成) A表中的多列对应B表中的同一列,请问如何查询数据? 如何把表A的结构复制给表B? Duwamsh的所有字符形都是用的Unicode,开发中是不是应该提倡这样? 提示一下该用什么函数???????????? sql 问题 WAIT…… 明天的一道面试题目 关于表联合的sql语句的 求助!
insert @t select '[email protected]'
union all select '[email protected]'
union all select '[email protected]'
union all select '[email protected]'
union all select '[email protected]'select t1
from @t
order by substring(t1 , charindex('@',t1) + 1, charindex('.',t1) - charindex('@',t1) -1)
--------------------
[email protected]
[email protected]
[email protected]
[email protected]
[email protected](所影响的行数为 5 行)
insert @t select '[email protected]'
union all select '[email protected]'
union all select '[email protected]'
union all select '[email protected]'
union all select '[email protected]'select t1
from @t
order by reverse(t1)
order by right(t1,len(t1)-charindex('@',t1)+1)