Hi All,

Tinkering with MySQL and I'm attempting to copy 3 fields from table A to table B. Simple enough, but while performing this copy, I'd like a 4th field to be calculated using the time_to_sec function.

As a standalone statement the below works fine for doing a time_to_sec select:

select round(time_to_sec(timediff(clockon,clockoff))/60) as minutes_worked from tableA where employee = 'John';
At the moment I have the below, which is an amalgamation of the above plus a straightforward field copy, but it doesn't work. If anyone can point me in the right direction (or even what to search for on the web since I haven't been able to stumble onto anything relevant) that'd be most welcome.

insert into tableB (employee, clockon, clockoff, minutes_worked) select employee, clockon, clockoff, minutes_worked as round (time_to_sec(timediff(clockon,clockoff))/60) from tableA where employee = 'John';