Re: "psql -At -F" export column from table to .csv

Поиск
Список
Период
Сортировка
От Stephen Frost
Тема Re: "psql -At -F" export column from table to .csv
Дата
Msg-id 20060211193751.GK4474@ns.snowman.net
обсуждение исходный текст
Ответ на "psql -At -F" export column from table to .csv  ("Nina" <dingjia@gmail.com>)
Список pgsql-general
* Nina (dingjia@gmail.com) wrote:
> I think you maybe familiar with this command:
> psql -At -F "," -c "select ..." > query.csv
>
> My question is:
> is it possible to export several different columns from different
> tables into the same .csv file; something like:  psql -At -F "," -c
> "select ..." "select ..." "select ..." "select ..." > query.csv
>
> Then, how to write the command in the correct way?

for table in a b c; do
  psql -At -F "," -c "select ... from $table" >> query.csv
done

    Enjoy,

        Stephen

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Doug McNaught
Дата:
Сообщение: Re: Last modification time
Следующее
От: Johan Vromans
Дата:
Сообщение: Re: Last modification time