Build a TIME value from two fields and then INTERVAL a third and fourth field

EDIT - SOLVED THIS (SEE POST BELOW)

I am working with 4 fields here. The original hour and minute values and then there are two more fields that are the increment to the original time value. I can build the original time value fine as shown below:

SELECT TIME(CONCAT(c1.ckhour , ':' ,c1.ckmin)) from table1 as c1

But I want to join another table and grab two hour and minute fields from there and do an INTERVAL addition to the time above to get the new time value.

So in pseudo code it would look like

SELECT TIME(t1.hourval1:t1.minuteval1) INTERVAL ((t2.hourval2 * 60) + t2.minuteval2) MINUTE FROM
table1 as t1 inner join table2 as t2 on t2.id = t1.id

This is as far as I got and it gives me a syntax error without any explanation. Just a note that the t2 fields are currently stored as strings if that makes a difference. Thanks

SELECT TIME(CONCAT(t2.ckhour, ':', t2.ckmin)) CONCAT(' INTERVAL ', ((t1.delayhour * 60) + t1.delaymin) , ' MINUTE') FROM
    table1 as t1 inner join table2 as t2 on t2.id = t1.id
select concat(date(now()), ' ', c1.ckhour,':',c1.ckmin,':00') + interval ((a1.delayhour*60) + a1.delaymin) minute as newtime
	from table1 as a1
	inner join table2 as c1 on c1.id = a1.id

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.