这是我目前的代码。 Job_detal.Date_sequence
格式为yy / mm / dd,我需要它为mmddyy,因此Crystal Reports可以正确查看日期。
SELECT
JOB_DETAIL.MACHINE
, JOB_DETAIL.JOB
, JOB_DETAIL.SUFFIX
, JOB_DETAIL.SEQ
, JOB_DETAIL.AMOUNT_LABOR
, JOB_DETAIL.AMT_OVERHEAD
, JOB_DETAIL.HOURS_WORKED
, JOB_DETAIL.DATE_SEQUENCE
FROM [TEST].[dbo].[JOB_DETAIL]
WHERE ((JOB_DETAIL.SUFFIX LIKE 'R01'
OR JOB_DETAIL.SUFFIX LIKE 'R02'
OR JOB_DETAIL.SUFFIX LIKE 'R03'
OR JOB_DETAIL.SUFFIX LIKE 'RO1')
OR (JOB_DETAIL.SEQ LIKE '5_____'
OR JOB_DETAIL.SEQ LIKE '998___'))
--AND JOB_DETAIL."DATE_SEQUENCE"='160224'
ORDER BY JOB_DETAIL.MACHINE
答案 0 :(得分:0)
想出来。谢谢你们!
SELECT
JOB_DETAIL.MACHINE
, JOB_DETAIL.JOB
, JOB_DETAIL.SUFFIX
, JOB_DETAIL.SEQ
, JOB_DETAIL.AMOUNT_LABOR
, JOB_DETAIL.AMT_OVERHEAD
, JOB_DETAIL.HOURS_WORKED
--, JOB_DETAIL.DATE_SEQUENCE
, SUBSTRING(JOB_DETAIL.DATE_SEQUENCE,3,4) + SUBSTRING(JOB_DETAIL.DATE_SEQUENCE,1,2) AS DATE2
FROM [TEST].[dbo].[JOB_DETAIL]
WHERE ((JOB_DETAIL.SUFFIX LIKE 'R01'
OR JOB_DETAIL.SUFFIX LIKE 'R02'
OR JOB_DETAIL.SUFFIX LIKE 'R03'
OR JOB_DETAIL.SUFFIX LIKE 'RO1')
OR (JOB_DETAIL.SEQ LIKE '5_____'
OR JOB_DETAIL.SEQ LIKE '998___'))
--AND JOB_DETAIL."DATE_SEQUENCE"='160224'
ORDER BY JOB_DETAIL.MACHINE
答案 1 :(得分:0)
这也可以在公式(或自定义函数)中完成:
datevalue({Job_detal.Date_sequence}[7 to 8] + "/" + {Job_detal.Date_sequence}[4 to 5] +"/" + {Job_detal.Date_sequence}[1 to 2])