I'm starting with a query like this: 

```
insert into summary ( col1, col2, Total ) 
select col1, col2, count(col4) as total from importdata 
where col1 = 'abc' and col4 in ('1A', '2A') 
group by col1, col2
order by col1, col2

```

and I haven't been able to determine how the correct 'on duplicate' clause. The clause I think I need is

```
on duplicate key update total=count(col4)

```

and I've placed it as the very last line in the query and as the line after the where clause, but both generated errors. Is my clause even correct and where does it need to go? 

(Worst case I can use 'insert ignore', but I think doing the update would be better.)