Re: Select last there dates

Поиск
Список
Период
Сортировка
От David Gardner
Тема Re: Select last there dates
Дата
Msg-id 467A8189.2050309@gardnerit.net
обсуждение исходный текст
Ответ на Select last there dates  ("Loredana Curugiu" <loredana.curugiu@gmail.com>)
Список pgsql-novice
I'm not sure about getting all the dates into a single comma separated
field, if table two had a unique id field, say table2.id then  this
should retrieve the last three dates per phone number:

SELECT table1.uid, table1.phone_number, table2.id, table2.date
FROM table1 JOIN table2 ON table1.uid=table2.uid
AND table1.phone_number=table2.phone_number
WHERE table1.uid = 8
AND (table2.id IN
(SELECT id FROM table2
WHERE table2.phone_number = table1.phone_number
ORDER BY table2.date DESC LIMIT 3 ));


--
David Gardner

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

Предыдущее
От: "Loredana Curugiu"
Дата:
Сообщение: Re: [SQL] Select last there dates
Следующее
От: "Andrej Ricnik-Bay"
Дата:
Сообщение: Re: stem override, tsearch2