39. 拼接表字段b.day

var fun = ABS_LOADBEAN("com.plug.FunctionHelper");
//var v_div = fun.funHelper.strAdd("‘<div>‘","b.Day");
//v_div = fun.funHelper.strAdd(v_div,"‘</div>‘");
var v_div = "‘<div>‘||"+"b.Day"+"||‘</div>‘";
var sql = " select max(ID) ID,NoofWeek,max(Week1) Week1,max(Week2) Week2,max(Week3) Week3,max(Week4) Week4,max(Week5) Week5,max(Week6) Week6,max(Week7) Week7 "
+" from ( "
+" select a.ID,to_number(to_char(b.Year)||(CASE WHEN b.NoofWeek>=10 THEN to_char(b.NoofWeek) ELSE ‘0‘||to_char(b.NoofWeek) END)) as NoofWeek,"
+" case when b.Week=1 then "+v_div+" else ‘‘ end as Week1,"
+" case when b.Week=2 then "+v_div+" else ‘‘ end as Week2,"
+" case when b.Week=3 then "+v_div+" else ‘‘ end as Week3,"
+" case when b.Week=4 then "+v_div+" else ‘‘ end as Week4,"
+" case when b.Week=5 then "+v_div+" else ‘‘ end as Week5,"
+" case when b.Week=6 then "+v_div+" else ‘‘ end as Week6,"
+" case when b.Week=7 then "+v_div+" else ‘‘ end as Week7 "
+" from T_HR_WorkCalendar a,tCalendar b"
+" where a.FAttendPeriod={0} and a.FWorkType={1} and to_char(a.FWorkDate,‘yyyyMMdd‘)=b.ID and funit = {2}"
+" ) x"
+" group by NoofWeek"
+" order by Noofweek";
sql

时间: 2024-11-05 18:54:28

39. 拼接表字段b.day的相关文章

MySQL 拼接表名递归寻找子节点和父节点

BEGIN declare lev int; -- 查询父级 set lev=1; drop table if exists tmp1; CREATE TABLE tmp1(ID VARCHAR(40),Wl_Code varchar(50),ParentCode varchar(40) ,levv INT); -- 用拼接的方式拼接表名和参数 SET @sqlcmd = CONCAT('INSERT tmp1 SELECT ID,Wl_Code,ParentCode,1 FROM ',tabl

salesforce 零基础开发入门学习(四)多表关联下的SOQL以及表字段Data type详解

建立好的数据表在数据库中查看有很多方式,本人目前采用以下两种方式查看数据表. 1.采用schema Builder查看表结构以及多表之间的关联关系,可以登录后点击setup在左侧搜索框输入schema Builder 或者build-->schema Builder进入: 2.采用force.com Explorer通过自己写查询语句来查询数据. 此链接为force.com Explorer的下载链接:  http://force-com-explorer-beta.software.infor

从PowerDesigner表字段的Name到EF实体类属性的Display Name(根据PowerDesigner生成EF实体类中文注释和验证元数据)

第一步:将PowerDesigner表字段的中文Name填入Comment中:工具-Execute Commands-Edit/Run Script... '****************************************************************************** '* File: name2comment.vbs '* Title: Name to Comment Conversion '* Model: Physical Data Model

让你提前认识软件开发(36):如何扩展数据表字段?

第2部分 数据库SQL语言 如何扩展数据表字段? [文章摘要] 在通信类软件中,经常会与数据库打交道.由于需求变化,或者是程序优化升级等原因,对数据表字段进行扩展是常有的事情.这就要求开发人员必须熟练掌握对数据表字段进行扩展的操作流程. 本文基于作者的数据库方面的工作经验,以实际的SQL程序为例,详细介绍了如何对对数据表字段进行扩展,为相关的开发工作提供了参考. [关键词] 数据库  数据表  扩展  SQL  开发 一.前言 在实际的软件开发项目中,对数据表字段的扩展包括如下两个方面: 第一,

asp创建表,复制表 字段类型附录

asp创建表,复制表 字段类型附录 在已有数据库中创建表  <% set conn=server.CreateObject("adodb.connection")  sql="provider=microsoft.jet.oledb.4.0;data source="&server.MapPath("BOOK.mdb")  conn.open sql  Conn.Execute("create table bbb(id A

Oracle 批量更新表字段

Oracle 批量更新表字段 CreateTime--2018年2月27日16:02:24 Author:Marydon (一) 将数字替换成汉字 第一步,去重查询 使用distinct关键字先对该字段值进行去重查询,看共有几种情况 --查询指定区间内表停诊字段的值 SELECT DISTINCT T.CLOSE_TZ FROM CONSULT_SCHEDULE T WHERE T.SCHEDULE_DATE BETWEEN TO_DATE('2018-01-01', 'yyyy-MM-dd')

SQL SERVER 一行按照某个由分隔符拼接的字段拆分成多行

数据库应用系统经常会遇到,某个字段存储通过分隔符来连接键值字符串,例如下表FileHistory 结构中列:Keywords 我们可能在某些业务场景下转换成以下形式: 首先,创建sql 函数,将拼接的字符串拆分成table CREATE FUNCTION [dbo].[UF_SplitStringToTable]( @sInputList VARCHAR(MAX) -- List of delimited items , @sDelimiter VARCHAR(20) = ',' -- deli

Excel快捷加表字段

1. 添加表字段=CONCAT("alter table ","表名"," add ",字段名," ",字段,";")       或者           =CONCAT("alter table ","表名"," add ",字段名," ",字段类型,"(",长度,",",精度,&qu

ubuntu12.04 mysql 添加表字段

1.登录数据库 2.切换数据库 3.增加字段 ap_record表增加字段status类型为int不能为空 alter table ap_record add status int not null;