Extract especific text from a sql statement

From: Emanuel Araújo <eacshm(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Extract especific text from a sql statement
Date: 2014-10-01 12:19:01
Message-ID: CAMuTAkab=h0pHDTi-69BU56kjZ5dWcy1kHaUC5C9veAA5xNNDw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I need help to extract fields and tables from a sql statement.

Example:

SELECT pc.cod, pc.val, pi.qtd,
COALESCE(pc.name, 'empty') AS name, lower(coalesce(pc.email, 'empty')) as
email,
status
FROM pc
INNER JOIN pi on (pc.cod = pi.cod)
WHERE pc.startdate > CURRENT_DATE
order by 1 desc
;

I need to return that:

pc.cod
pc.val
pi.qtd
pc.name
pc.email
status
pc
pi
pc.startdate

can you help me ?

--

*Atenciosamente,Emanuel Araújo*

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Daniel Begin 2014-10-01 14:13:22 Best practices for Large import in empty database?
Previous Message Felix Kunde 2014-10-01 09:19:01 Re: table versioning approach (not auditing)