Difference in columns
От | Mag Gam |
---|---|
Тема | Difference in columns |
Дата | |
Msg-id | 1cbd6f830805111037m488f7051i7924060a1640fff4@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: Difference in columns
Re: Difference in columns Re: Difference in columns Re: Difference in columns Re: Difference in columns |
Список | pgsql-sql |
Hi All,<br /><br />I have a view that generates output similar to this.<br /><br />select * from foo.view;<br /><br /><preclass="PROGRAMLISTING"> ts | size<br />-------------------+-----<br /> 2002-03-16 | 11 <br />2002-03-17 | 16 <br />2002-03-18 | 18<br /> 2002-03-19 | 12 <br /></pre>I am trying to find the difference between the size column. So the desired output would be<br /><br /><pre class="PROGRAMLISTING"> ts | size| Diff<br />-------------------+-----+------<br /> 2002-03-16 | 11 | 0<br />2002-03-17 | 15 | 4<br /> 2002-03-18 | 18 | 3<br /> 2002-03-19 | 12 | -6<br /></pre><br/>I need the first column to be 0, since it will be 11-11. The second colum is 15-11. The third column is 18-15.The fourth column is 12-18. <br /><br />Any thoughts about this?<br /><br />TIA<br />
В списке pgsql-sql по дате отправления: