sql查询语句

查询情侣号码,截取号码的后四位数,并且无重复,对所有的电话号码随机抽取六个的语句生成如下:

select top 6 T1.number,newid() from (
						select distinct 
						substring(number,8,11) as number
						from tb_entity_number where flag = 1)  T1 order by newid()

 

你可能感兴趣的:(sql)