what this error in mysql
===

I want to fire below query on tm_matrix but gives me following error

    mysql> INSERT INTO tm_matrix (VDT,VID)VALUES(replace(left(now(),10),'-',''),(SE
    LECT CASE WHEN MAX(VID) IS NULL THEN 000001 ELSE (MAX(VID)+1) END AS VID FROM tm
    _matrix));

ERROR 1093 (HY000): You can't specify target table 'tm_matrix' for update in FROM clause

If I fire below query then gives me following error

    mysql> INSERT INTO tm_visitor (VDT,VID)VALUES(replace(left(now(),10),'-',''),SEL
    ECT CASE WHEN MAX(VID) IS NULL THEN 000001 ELSE (MAX(VID)+1) END AS VID FROM tm_
    visitor);

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'SELEC
T CASE WHEN MAX(VID) IS NULL THEN 000001 ELSE (MAX(VID)+1) END AS VID FROM ' at
line 1

