3
create table ApplicationTracker_dup1
select transactionid,
       count(case when attribute = 'Secci_Page_Arrival_Time' and value is not null then transactionid end)as secci_visits,
       count(case when attribute = 'esign_arrival_time' and value is not null then transactionid end)as esig_visits 
from ApplicationTracker_dup 
where create_dtm < '2013-08-13' 
group by 1;

当我运行这段代码时,我遇到

错误 1292 (22007):截断不正确的整数值:'E031CF1DE8F7'"

并且没有创建表。有人可以在这里帮助我吗?

4

2 回答 2

1

您应该在count func中使用 int 或 NULL ,而不是 char 和其他类型因此,此代码应该可以在没有警告的情况下工作:

create table ApplicationTracker_dup1
select transactionid,
       count(if(attribute = 'Secci_Page_Arrival_Time' and value is not null,1,NULL)) as secci_visits,
       count(if(attribute = 'esign_arrival_time' and value is not null,1,NULL)) as esig_visits 
from ApplicationTracker_dup 
where create_dtm < '2013-08-13' 
group by 1;
于 2014-10-09T16:17:09.423 回答
1

不幸的是,您没有发布ApplicationTracker_dup表定义脚本,所以我建议尝试attribute在 select 子句中的create_dtm列或这样的列中使用 cast:

cast(attribute as char)

或者

cast(create_dtm as char)
于 2013-09-18T10:48:12.980 回答