国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

SQL函數(不定時更新)

2024-07-21 02:46:00
字體:
來源:轉載
供稿:網友
SQL函數(不定時更新)

sum求和:select sum(a) from table1 group by b 依據b列為a列求和

distinct去除重復:select distinct(a) from table1 顯示表中的a列,不顯示重復項

select distinct a,b from table1 顯示表中不重復的a,b列

cast轉換數據類型:select cast a asdecimal(18,2) from table1 將選出的數據轉換成知道類型

case函數:select a,b=case when b<500 then 0 elseb end ,c from table 選出b列,選出的數據小于500的話顯示0

isnull函數:select isnull(a,0) from table1 選出a列,如果a列是null的話,顯示0

left join:返回左邊表所有行,right join:返回右邊表所有行,inner join:返回左右表符合要求的行

自定義函數:遍歷逗號分割的字段

create function browseid(@a NVarchar(max),@split NVarchar(10))returns @t table(c1 varchar(100))as begindeclare @i int,@s int,@aa NVarchar(max)set @aa=select nameid from bianliset @i=1set @s=1while(@i>0)beginset @i=CHARINDEX(@split,@a,@s)if(@i>0)begininsert @t(c1) values(substring(@a,@s,@i-@s))endelse begininsert @t(c1) values(substring(@a,@s,len(@a)-@s+1))endset @s=@i+1endreturnend


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 宜章县| 嘉善县| 清流县| 于都县| 云安县| 延边| 衡山县| 北宁市| 嘉禾县| 浦县| 定结县| 呈贡县| 新闻| 清苑县| 建瓯市| 临武县| 蒙城县| 杭锦旗| 沙湾县| 册亨县| 太仆寺旗| 平遥县| 瑞昌市| 云阳县| 梨树县| 宜昌市| 高邑县| 信阳市| 独山县| 晴隆县| 巨野县| 宣威市| 万州区| 从江县| 霍邱县| 保山市| 台中市| 疏勒县| 邓州市| 鲁山县| 鸡泽县|