Re: return records with more than one occurrences

Поиск
Список
Период
Сортировка
От Jasmin Dizdarevic
Тема Re: return records with more than one occurrences
Дата
Msg-id AANLkTikOHwV56NvXZBSZ19yWOW_kVYGm=bqaik-k07pS@mail.gmail.com
обсуждение исходный текст
Ответ на return records with more than one occurrences  (Tarsis Lima <tarsis.lima@gmail.com>)
Список pgsql-sql
Hi, 

this is a good point to start.

select t2.* from table2 t2
inner join (
  select id from table1 
  group by id
  having count(*) > 1
) t1 on t2.id_table1 = t1.id

2011/1/5 Tarsis Lima <tarsis.lima@gmail.com>
how would the SELECT to  return only records with more than one
occurrences  of id_table1? example:
 -- Table1
 -- id --
-------------------------
   1
   2


-- Table2
  id  --- | id_table1 | name
 ----------------------------------------------
  4  ---- | -----  1 ------ |   Tom
  5  ---- | -----  1 ------ |   Luci
  6  ---- | -----  2 ------ |  Cleber   ------>this can not return




--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

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

Предыдущее
От: "Good, Thomas"
Дата:
Сообщение: pattern matching with dates?
Следующее
От: Samuel Gendler
Дата:
Сообщение: Re: pattern matching with dates?