方法一:convert(float,字段名) as 别名 select convert(float,round(10.123232,2)) 结果:10.12 select convert(float,round(10,2)) 结果:10 方法二:cast(round(字段名,2) as numeric(20,2)) as 别名 select cast(round(10.123232,2) as numeric(20,2)) 结果:10.12 select cast(round(10,2) as
语法: CONVERT(VARCHAR(7),<字段名称>,121) 时间转字符:select CONVERT(VARCHAR(7),dyxq,121),* from TBYPKC03--取年月select CONVERT(VARCHAR(10),dyxq,121),* from TBYPKC03--取年月日
Ma,LeiTo(Ma,lT) 分割后为 姓 名 Ma,LeiTo Ma,lT SELECT LEFT(作者, CHARINDEX('(', 作者) - 1) AS 姓 , replace( STUFF(作者,1, CHARINDEX('(', 作者) , ''),')','') AS 名 ,* FROM 作者表 删除最大值 delete from 表 where id in( SELECT id FROM dbo.表 T WHERE EXISTS (SELECT name F
实用的SQL语句 行列互转 create table test(id int,name varchar(20),quarter int,profile int) insert into test values(1,'a',1,1000)insert into test values(1,'a',2,2000)insert into test values(1,'a',3,4000)insert into test values(1,'a',4,5000)insert into test va
行列互转 ) select * from test2 --列转行 select id,name,quarter,profile from test2 unpivot ( profile for quarter in ([Q1],[Q2],[Q3],[Q4]) ) as unpvt sql替换字符串 substring replace SQL查询一个表内相同纪录 having 如果一个ID可以区分的话,可以这么写 ) 如果几个ID才能区分的话,可以这么写 其他回答:数据表是zy_bho,想找
function HIBC_CheckCode(code) { var nonCheckCode = code.substr(0, code.length - 1); var arr = nonCheckCode.split(""); var sum = 0; var arrayDic = new Array(); arrayDic["0"] = "0"; arrayDic["1"
整理了日常用到的一些sqls 1.插入表 insert into table_B select * from table_A 2.清空表 truncate table test #清空表,结构还存在delete table test where ... #删除表中特定的数据drop table test #删除整表,包括结构 3. 导出到文件 select * from table_A where filed1 like '8422%' into outfile '/usr/local/mysq
一.统计语句 1. count count(*)与count(0)语句的区别: count(*)统计所有数量 count(0)统计第一列不为空的 2. 两个统计量的减法 select (select count(*) from defect)-(select count(*) from defect where cljg like '%合格%' and cljg not like '%不合格%') as count from dual 3. min.max.常见数学函数的使用 ) from hv
在pptv的实习结束了, 忙着找工作的事,顺便把数据结构的那本书重新复习了一遍.为了加深印象,特意把里面的常用的排序.查找算法用js写了一遍 具体的实例在我的github上,大家可以访问的: https://github.com/chenkehxx/practice js_sort.html文件 //js插入排序 function insertSort(arr){ var result =[]; result.push(arr[0]); for(var i = 1, len = arr.
第一部分 基本语法 //拼接表字段 select id || 'is' || name from admin select * from emp where ename like '%s%';//模糊查询 select * from emp where mgr is null ; //查询表列为空的 to_date('2011-12-12','yyyy-mm-dd') //插入时间格式 to_date() //给表字段取别名 select id as 这是ID , name