zoukankan      html  css  js  c++  java
  • 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   
    )
  • 相关阅读:
    python 小练习 5
    python 小练习4
    python 小练习3
    python 小练习2
    遇到后缀名为whl的库的安装方法
    hdu1394Minimum Inversion Number
    Triangle
    codeforces B. Pasha and String
    F
    C
  • 原文地址:https://www.cnblogs.com/BoyStyle/p/8966084.html
Copyright © 2011-2022 走看看