Re: put text list into table form

From: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
To: Web2cad <alex(at)web2cad(dot)co(dot)jp>, <pgsql-novice(at)postgresql(dot)org>
Subject: Re: put text list into table form
Date: 2006-01-31 11:57:04
Message-ID: C004BAC0.4CDB%sdavis2@mail.nih.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On 1/30/06 7:24 PM, "Web2cad" <alex(at)web2cad(dot)co(dot)jp> wrote:

> Hi Sean
> thanks for the reply.
>
> I ultimatly want to count the number of users per city, for the cities with
> no users I want to show a 0.
> The list of cities that I want a count for are stored in flat file.
> (this is something I inherited, rather bad system/DB design I know, will
> have to push for a rework at a later date)
>
> So I need to produce a city table from flat file temporarily then LEFT JOIN
> that table to the user table.
> giving somthing like:

Create temporary table city_table (
...
);

In psql, you can then do:

\copy city_table from 'flat.file.txt'

To populate the table. Note that the temporary table is only visible to the
session that created it and will be dropped after that session is closed.

Sean

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message kynn 2006-01-31 12:17:17 How to define variables in psql?
Previous Message Charley Tiggs 2006-01-31 08:59:20 Re: Insert Text