Re: Control PhoneNumber Via SQL
От | tango ward |
---|---|
Тема | Re: Control PhoneNumber Via SQL |
Дата | |
Msg-id | CAA6wQLLx3F1Xd_SN7+cQ3O9gu5FKJEZsE5pgwgxQC7kwW=mu-w@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Control PhoneNumber Via SQL (tango ward <tangoward15@gmail.com>) |
Ответы |
Re: Control PhoneNumber Via SQL
Re: Control PhoneNumber Via SQL |
Список | pgsql-general |
Okay, I figured it out.
cur_t.execute("""
SELECT
CASE
WHEN mobilenumber ~'^0[1-9]'
THEN regexp_replace(mobilenumber, '0', '+63')
ELSE mobilenumber
END
FROM studeprofile
ORDER BY lastname
""")
In my previous SELECT statement, I picked the mobilenumber before running a CASE statement to it instead of jumping directly to CASE statement after SELECT. cur_t.execute("""
SELECT
CASE
WHEN mobilenumber ~'^0[1-9]'
THEN regexp_replace(mobilenumber, '0', '+63')
ELSE mobilenumber
END
FROM studeprofile
ORDER BY lastname
""")
On Wed, May 16, 2018 at 8:59 AM, tango ward <tangoward15@gmail.com> wrote:
Did the CASE Statement produce the other columns Sir?On Wed, May 16, 2018 at 8:53 AM, David G. Johnston <david.g.johnston@gmail.com> wrote:On Tuesday, May 15, 2018, tango ward <tangoward15@gmail.com> wrote:I can access the index 1 of the output list to get the +639078638001. I think this has been explained already by Sir Adrian in my previous question about the about being shown as list. I'll review that.Last time you had multiple rows...this time you have multiple columns...David J.
В списке pgsql-general по дате отправления: