How to convert date YYYYMMDD to YY-MM-DD in MySQL query
===

I have a date column which is in YYYYMMDD or 20120101 format. 

How can I convert this to a YYYY-MM-DD format in a MySQL query? In DB2, I used a to_date() function.

In MySQL, I'm trying the STR_TO_STRING() function but it returns 'null'.

      SELECT STR_TO_DATE(VBAP.ERDAT,'%Y-%m-%d') FROM VBAP


