| From: | Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> |
|---|---|
| To: | Ertan Küçükoğlu <ertan(dot)kucukoglu(at)1nar(dot)com(dot)tr> |
| Cc: | pgsql-sql <pgsql-sql(at)lists(dot)postgresql(dot)org>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
| Subject: | Re: Converting from MySQL |
| Date: | 2019-01-23 06:38:55 |
| Message-ID: | 87k1iv3n3k.fsf@news-spur.riddles.org.uk |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
>> 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)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Rossi, Maria | 2019-01-23 19:06:05 | Back-out V10 upgrade but keep new data |
| Previous Message | David G. Johnston | 2019-01-22 21:42:25 | Re: Converting from MySQL |