Date Duration Numbers
От | John Nix |
---|---|
Тема | Date Duration Numbers |
Дата | |
Msg-id | Pine.LNX.4.44.0207091214520.28748-100000@server.sblug.org обсуждение исходный текст |
Ответы |
Re: Date Duration Numbers
Re: Date Duration Numbers |
Список | pgsql-novice |
I have a problem, I need to find out how many days there are between 2 date fields and then add all the dates up. Example... name | start_date | end_date ------+------------+------------ Joe1 | 2002-01-01 | 2002-01-02 Joe2 | 2002-01-01 | 2002-01-03 Joe3 | 2002-01-01 | 2002-01-04 Joe4 | 2002-01-01 | 2002-01-05 Joe5 | 2002-01-01 | 2002-01-06 As you can see, the duration is: Joe1 - 1 day Joe2 - 2 days Joe3 - 3 days Joe4 - 4 days Joe5 - 5 days Now that I have the duration between the times, I need to add up all those numbers: 1 day 2 days 3 days 4 days + 5 days ---------- 15 days I can use age() to get my interval (select age(date '2002-01-02', date '2002-01-01')), but I can't seem to use the field names with that, I have to manually enter in all the dates. I have about 900 entries in this table. Is there a way to do this? Thanks... John
В списке pgsql-novice по дате отправления: