函数使用"/>
SqlServer函数使用
SqlServer去除重复查询第一条数据:select ID from(select *, row_number() over (partition by SynCode order by id) as RowNum from syn_table) s where s.RowNum = 1SqlServer合并行用逗号隔开:
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 aSqlServer字符串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函数使用
发布评论