Re: Converting from MySQL
Andrew Gierth <[email protected]> Wed, 23 Jan 2019 06:38:55 +0000
| Newsgroups | gmane.comp.db.postgresql.sql |
|---|---|
| Message-ID | <[email protected]> |
>> Failed to find PostgreSQL equivalent for below one because I did not >> understand what it does in the first place. >> >> SELECT >> CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/') >> FROM users WHERE email='%s' It looks to me like this would work as well or better in PG: select regexp_replace(email, '^(.*)@(.*)$', '\2/\1/') from ... -- Andrew (irc:RhodiumToad)