Re: SQL query...

Поиск
Список
Период
Сортировка
От Mario Weilguni
Тема Re: SQL query...
Дата
Msg-id 003b01c2d81c$3e716d20$8f01c00a@icomedias.com
обсуждение исходный текст
Ответ на SQL query...  (jerome <jerome@gmanmi.tv>)
Ответы Re: SQL query...
Re: SQL query...
Список pgsql-general
>if i have 5 tables and all of it has column X and i wanted to get unique
>values in column X for all tables..

>can i do it in one query?

sure. this is one way to do this:
select distinct foo.X from (
  select X from table1
  union
  select X from table2
  ....
 ) as foo;

if the values are unique within every table, then you might want to omit the
surrounding select.



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

Предыдущее
От: Oliver Elphick
Дата:
Сообщение: Re: How do I get the database connections to close down?
Следующее
От: "Mark Cave-Ayland"
Дата:
Сообщение: Re: 7.3.1 takes long time to vacuum table?