Reputation: 31
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;
when I run this code, I encounter
ERROR 1292 (22007): Truncated incorrect INTEGER value: 'E031CF1DE8F7'"
and table is not being created. Can some one help me here?
Upvotes: 3
Views: 2682
Reputation: 1764
You should use int or NULL in count func, not char and other types So, this code should work without warnings:
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;
Upvotes: 1
Reputation: 96
Unfortunately you didn't post ApplicationTracker_dup
table definition script so I propose to try use cast either with attribute
columns in select clause or with create_dtm
column like this:
cast(attribute as char)
or
cast(create_dtm as char)
Upvotes: 1