I want split one row in several rows in SQL.
For example, I have 'A ADCT DROP INCALL -' that contain spaces and a '-' and I want that there values remain separate in several rows for example.
Original result:
SELECT statuses FROM campaigns;
+-----------------------------------------+
| RESULT OF QUERY |
+-----------------------------------------+
| A ADCT DROP INCALL - |
+-----------------------------------------+
The result must like:
+-----------------------------------------+
| RESULT OF QUERY |
+-----------------------------------------+
| A |
| ADCT |
| DROP |
| INCALL |
+-----------------------------------------+
I try with SUBSTRING_INDEX like:
SELECT status
FROM statuses
WHERE statuses.status NOT IN (SELECT SUBSTRING_INDEX(TRIM(dial_statuses)," ", 1) FROM campaigns WHERE campaign_id = '4000')
ORDER BY STATUS;
I'm sorry, I know that is so basic.