I would like the SQL to retrieve text data from a simple single MySQL table, where every (space delimited) word in a field is doubled / immediately repeated in the result.
Sample table
+--------------------+
| text_data |
+--------------------+
| The man walks. |
| Apple pie. |
| This is a sentence |
+--------------------+
Desired output.
+---------------------------------------+
| output |
+---------------------------------------+
| The The man man walks. walks. |
| Apple Apple pie. pie. |
| This This is is a a sentence sentence |
+---------------------------------------+
The order of the words is important.
Edit 1: This does have to be done in dynamically in SQL (no temp tables, no php) due to the application layer (the context is the index generation in Sphinx) and the ever changing nature of the source data.
Edit 2 (more detailed context): I want the wordforms functionality in Sphinx to handle certain pairs of words non-destructively. That is, if I turn "playstation 3" into "playstation playstation 3 3", I can still apply the word form "playstation 3 > ps3", and effectively the article would be searchable by both the queries "playstation" and "ps3". If I don't double up, but still apply the wordform, then I lose the ability to retrieve the article by searching for "playstation".