MySQL fix

Just copied the standard SQL code that MarioE has made, tested as working.