My SQL removes all occurrences. How to remove only the last <br> ?
SELECT REPLACE( 'aaa bbb <br> ccc <br> ddd', '<br>', '' ); My SQL removes all occurrences. How to remove only the last <br> ?
SELECT REPLACE( 'aaa bbb <br> ccc <br> ddd', '<br>', '' ); SQL is not intended for such tasks as text conversion and, moreover, HTML. Choose the right tools for solving problems. But if you really want it all, then of course you can also on MySQL, but it turns out creepy:
select concat( substr(STR,1,length(STR)-length(substring_index(STR, '<br>', -1))-length('<br>')), substring_index(STR, '<br>', -1) ) from ( SELECT 'aaa bbb <br> ccc <br> ddd' as STR ) A Source: https://ru.stackoverflow.com/questions/568997/
All Articles