Question : Need MySQL version of MSSQL code

Please help with conversion to MySQL, thanks in advance.
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
UPDATE Category
SET    
    Path = 
      CASE
          WHEN Inserted.ParentID IS NULL THEN '.' 
          ELSE ParentCategory.Path
          END + CAST(Inserted.Id AS varchar(10)) + '.'
FROM        Inserted INNER JOIN
                      Category ON Inserted.Id = Category.Id 
                      LEFT OUTER JOIN
                      Category AS ParentCategory ON Category.ParentCategoryId = ParentCategory.Id
Open in New Window Select All

Answer : Need MySQL version of MSSQL code

1:
2:
3:
4:
5:
6:
7:
8:
CREATE TRIGGER tttttt AFTER INSERT ON xxx
FOR EACH ROW BEGIN
UPDATE Category SET Path =
CONCAT(IF(NEW.ParentID IS NULL,'.' ,ParentCategory.Path),CAST(NEW.Id AS char(10)) , '.')
FROM Category ON Inserted.Id = Category.Id 
LEFT JOIN Category AS ParentCategory ON Category.ParentCategoryId = ParentCategory.Id
WHERE Category.Id = NEW.Id  
END;
Open in New Window Select All
Random Solutions  
 
programming4us programming4us