| From: | John R Pierce <pierce(at)hogranch(dot)com> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: Save query results to new table |
| Date: | 2016-10-28 00:00:59 |
| Message-ID: | 14c52fce-5ce1-5095-3a96-ecf412df0dd6@hogranch.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On 10/27/2016 4:57 PM, Rich Shepard wrote:
> It's been several years since I worked with postgres so I tried
> searching
> the web for the correct syntax to save query results to a new table, but
> without results.
>
> I'm running postgresql-9.5.4 here. The query extracts 28162 rows from a
> table of 122365 rows. I thought 'save table as' would do the job but have
> not found the correct syntax to do this.
>
> My query is:
>
> select * from monitor_sites where param = 'Cd' or param = 'Co' or
> param = 'As' or param = 'Hg' or param = 'Zn' or param = 'Pb' or param
> = 'Cr' or
> param = 'Cu';
>
> If you point me to the appropriate page in the 9.5.x manual I'll
> figure it
CREATE TABLE newtable AS SELECT ...
https://www.postgresql.org/docs/9.5/static/sql-createtableas.html
--
john r pierce, recycling bits in santa cruz
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Rich Shepard | 2016-10-28 00:04:18 | Re: Save query results to new table [RESOLVED] |
| Previous Message | Rich Shepard | 2016-10-27 23:57:54 | Save query results to new table |