Search code examples
sqlmysql-error-1052

#1052 - Column 'date' in field list is ambiguous


update callingroute AS t1
INNER JOIN callingroute AS t2                
SET t1.day = (select date FROM (select dayname(date) from callingroute where status = 'OK')AS X) 
WHERE t1.calling_route_id IS NOT NULL;

// Any idea why i get these errors


Solution

  • If anything the query should be shortened to

    update callingroute AS t1                
    SET t1.day = dayname(date) 
    WHERE t1.calling_route_id IS NOT NULL
      AND status = 'OK';