select a + ' '+b as ab from tableName 如果是有整型的(例,b字段为int类型): select a +' '+Convert(VARCHAR(50),b) as ab from tableName 如果是有小数的(例,b字段为float类型) select a +' '+convert(varchar(20),convert(decimal(18,4),b)) as ab from tableName 注释:a,b为列名…
select B.enterprise_code, B.enterprise_name, sum(B.h0_overnum) AS over00, sum(B.h1_overnum) AS over01, sum(B.h2_overnum) AS over02, sum(B.h3_overnum) AS over03, sum(B.h4_overnum) AS over04, sum(B.h5_overnum) AS over05, sum(B.h6_overnum) AS over06, su…
SQL Server查询时添加一列连续的自增列 在SQL Server数据库中表信息会用到Identity关键字来设置自增列.但是当有数据被删除的话,自增列就不连续了.如果想查询出这个表的信息,并添加一列连续自增的ID,可用如下查询语句: select Row_Number() over ( order by getdate() ) as init , * from 表名…