| От | James Cloos |
|---|---|
| Тема | [MASSMAIL]help with a particular multi-table query |
| Дата | |
| Msg-id | m3frw468r5.fsf@nitrogen.jhcloos.org обсуждение |
| Ответы |
Re: help with a particular multi-table query
|
| Список | pgsql-sql |
I'm attempting a three column select from two tables, where only a
single column from each of the tables matters.
t1.date and t2.time are both timestamptz.
I want the three columns to be:
t1.date::date
t1.date - lag(t1.date,1) over (order by date asc) days,
and count(t2.time) from the interval lag(t1.date,1) and t1.date.
but that syntax of course fails do to the placements I've tried for thae
between.
I tried a sub-query but got what looked like an outer join.
I want exactly count(*) from t1 rows in the result.
What trick am I missing?
-JimC
--
James Cloos <cloos@jhcloos.com>
OpenPGP: https://jhcloos.com/0x997A9F17ED7DAEA6.asc
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера