|
楼主 |
发表于 2007-7-5 11:28:44
|
显示全部楼层
以下是我的数据集的SQL
主数据集:
select distinct(t.f_date) 日期 from dcs_batch_package_info_zys t
where t.f_date>=&[Biz:\SCZYCX\DICT\QJGGCS.ParamGroup\CXQSSJ_ZF.Param]
and t.f_date<=&[Biz:\SCZYCX\DICT\QJGGCS.ParamGroup\CXZZSJ_ZZ.Param]
order by t.f_date
从数据集:
SELECT t.f_date 日期,
t.f_name 牌号,
t.f_opno 批次号,
t.f_start_time 开始时间,
t.f_end_time 结束时间,
t."1" "1",
t."2" "2",
t."3" "3",
t."4" "4",
t."5" "5",
t."6" "6",
t."7" "7",
t."8" "8",
t."9" "9",
t."10" "10",
t."11" "11",
t."12" "12",
t."13" "13",
t."14" "14",
t."15" "15",
t."16" "16",
t."17" "17",
t."18" "18",
t."19" "19",
t."20" "20",
t."21" "21",
t."22" "22",
t."23" "23",
t."24" "24",
t."25" "25",
t."26" "26",
t."27" "27",
t."28" "28",
t."29" "29",
t."30" "30",
t."31" "31",
t."32" "32",
t."33" "33",
t."34" "34",
t."35" "35",
t."36" "36",
t."37" "37",
t."38" "38",
t."39" "39",
t."40" "40",
t.f_total 合计,
decode(trim(t.f_name),
'双喜',
t.f_total - 34 * 200,
'双喜经典醇香',
t.f_total - 27 * 200,
null) 偏差
FROM dcs_batch_package_info_zys t
where t.f_date >=&[Biz:\SCZYCX\DICT\QJGGCS.ParamGroup\CXQSSJ_ZF.Param]
and t.f_date <=&[Biz:\SCZYCX\DICT\QJGGCS.ParamGroup\CXZZSJ_ZZ.Param]
ORDER BY t.f_date, t.f_name, t.f_opno |
|