Search code examples
mysqllaraveltriggersdatabase-trigger

How to concat dot(.) to string like pic.jpeg in mysql triggers?


I am getting this error

Column not found: 1054 Unknown column '.' in 'field list.'

Code:

NEW.student_img_name = CONCAT(NEW.student_roll_no,'.',
                              (SUBSTRING_INDEX(NEW.student_img_name, `.`, -1)))

Solution

  • NEW.student_img_name = CONCAT(NEW.student_roll_no,'.',
                                 (SUBSTRING_INDEX(NEW.student_img_name, '.', -1)))
    

    Try this? Maybe the error showing up is not the First dot, but the second one in SUBSTRING_INDEX.