Re: sum but not grouped by?
От | Luca Rasconi Master |
---|---|
Тема | Re: sum but not grouped by? |
Дата | |
Msg-id | 42F62031.9070700@students.cefriel.it обсуждение исходный текст |
Ответ на | sum but not grouped by? (Henry Ortega <juandelacruz@gmail.com>) |
Список | pgsql-sql |
let ff your table...<br /> try this:<br /><b>select </b><br /> a.id, <br /> a.date, <br /> a.hours, <br /> (<b>select </b>sum(b.hours) <br /> <b>from </b>ff as b<br /> <b>where </b>a.id = b.id <br /> <b>group</b>by b.id <br /> ) as a <br /> <b>from </b>ff as a;<br /><br /> bye,<br /> Luca<br /><br /> Henry Ortegaha scritto:<br /><blockquote cite="mid2bffcc33050805092862a01b93@mail.gmail.com" type="cite"><pre wrap="">I have theff data: id | date | hours AAA 07-01-2005 3 AAA 07-02-2005 4 BBB 07-01-2005 6 BBB 07-02-2005 2 BBB 07-03-2005 7 Would it be possible to get the ff: id | date | hours | id_total AAA 07-01-2005 3 7 AAA 07-02-2005 4 7 BBB 07-01-2005 6 15 BBB 07-02-2005 2 15 BBB 07-03-2005 7 15 So it's like SUM OF, but not Grouped By? Is this possible at all? Thank you for any help. ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? <a class="moz-txt-link-freetext" href="http://www.postgresql.org/docs/faq">http://www.postgresql.org/docs/faq</a></pre></blockquote><br />
В списке pgsql-sql по дате отправления: