SqlServer函数使用

编程入门 行业动态 更新时间:2024-10-23 07:16:32

SqlServer<a href=https://www.elefans.com/category/jswz/34/1771370.html style=函数使用"/>

SqlServer函数使用

SqlServer去除重复查询第一条数据:
  select ID from(select *, row_number() over (partition by SynCode order by id) as RowNum  from syn_table) s  where s.RowNum = 1
SqlServer合并行用逗号隔开:
  SELECT name,LEFT(ItemName,LEN(ItemName)-1) FROM (SELECT name,(SELECT name+',' FROM Base_BarcodeGroup c WHERE c.NAME=b.Name FOR XML PATH(''))AS ItemName  FROM  Base_BarcodeGroup as b  GROUP BY   name)AS a
SqlServer字符串in查询
  DECLARE @UnitCode VARCHAR(50)='1,2,3'select * from dbo.Table1 where PATINDEX('%,'+RTRIM(TestNo)+',%',','+@UnitCode+',')>0

 

Oreacle 批量插入:

Insert into 表名(ID,Name,Sex) 
select SEQ_Table_ID.nextVal,Name,Sex from (select  '张三'  name,'男' Sex from dual  union select  '李四'  name,'男' Sex from dual   
)

 

转载于:.html

更多推荐

SqlServer函数使用

本文发布于:2024-03-13 16:43:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1734403.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:函数   SqlServer

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!