I need to return all db-rows which match the following criteria:
SELECT col FROM tbl WHERE ALL 'reversed-sub-strings' of 'reversed-string' = col
Example:
some-string = 123456
should return rows that equal
6
56
456
3456
23456
123456
Of course we cannot use “WHERE col LIKE ‘%some-string’ ” because it would just return one row.
Also I am unwilling to create all the strings before sending them to the db.
I am using MySQL 5, maybe some Regex would help?
If I understand your requirement correctly, this should do what you want;