我正在使用Tableau 10.3,我想从另一个表中检索特定日期的“ where”子句。
我正在使用以下代码:
select companycode, branchcode, transactiondate, RunRequestedDate, StopExecutionDate,
DateDiff(second, RunRequestedDate, StopExecutionDate) as totalseconds, DateDiff(second, RunRequestedDate, StopExecutionDate)/3600 as Hours,
(DateDiff(second, RunRequestedDate, StopExecutionDate)%3600)/60 as Minutes, DateDiff(second, RunRequestedDate, StopExecutionDate)%60 as Seconds
from PackagesInputParameters where cast(runrequesteddate as date)='09/01/2018' and ProcessDescription='DataPreparation'and id in
(select SessionID from DataPreparationLog where uploaddate='<DAY(Date)>' and ProcessName='Retalix File Processing')
但我收到一条错误消息:
Tableau数据引擎错误:40705:数据源异常类型:未知 查询:SELECT [自定义SQL查询]。[小时] AS [小时],[自定义SQL 查询]。[分钟] AS [分钟],[自定义SQL查询]。[RunRequestedDate] AS [RunRequestedDate],[自定义SQL查询]。[秒] AS [秒], [自定义SQL查询]。[StopExecutionDate] AS [StopExecutionDate],[自定义 SQL查询]。[分支代码] AS [分支代码],[自定义SQL 查询]。[公司代码] AS [公司代码],[自定义SQL 查询]。[总秒数] AS [总秒数],[自定义SQL 查询]。[transactiondate] AS [transactiondate] FROM(选择 公司代码,分支代码,transactiondate,RunRequestedDate, StopExecutionDate,DateDiff(second,RunRequestedDate, StopExecutionDate)作为总秒数,DateDiff(秒,RunRequestedDate, StopExecutionDate)/ 3600,以小时表示,(DateDiff(second,RunRequestedDate, StopExecutionDate)%3600)/ 60分钟,DateDiff(second, RunRequestedDate,StopExecutionDate)%60,以秒为单位 PackagesInputParameters其中,cast(runrequesteddate为 date)='09/01/2018'和ProcessDescription ='DataPreparation'和ID (从DataPreparationLog中选择SessionID,其中 uploaddate =''和ProcessName ='Retalix文件处理')) [自定义SQL查询] [Microsoft] [SQL Server的ODBC驱动程序13] [SQL 服务器]从中转换日期和/或时间时转换失败 字符串。