Difference in columns

Поиск
Список
Период
Сортировка
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 по дате отправления:

Предыдущее
От: "Christian Kindler"
Дата:
Сообщение: Re: execute plpgsl like "normal" sql
Следующее
От: chester c young
Дата:
Сообщение: Re: Difference in columns