Re: [SQL] changing multiple pk's in one update

2009-04-10 Thread Jasen Betts
On 2009-04-08, Stuart McGraw wrote: > Hello all, > > I have a table with a primary key column > that contains sequential numbers. > > Sometimes I need to shift them all up or down > by a fixed amount. For example, if I have > four rows with primary keys, 2, 3, 4, 5, I > might want to shift them

Re: [SQL] How would I get rid of trailing blank line?

2009-04-10 Thread Jasen Betts
On 2009-04-02, Tena Sakai wrote: > I am using postgres 8.3.4 on linux. > I often use a line like: > psql -tf query.sql mydatabase > query.out > > -t option gets rid of the heading and count > report at the bottom. There is a blank line > at the bottom, however. Is there any way to > have psql

Re: [SQL] changing multiple pk's in one update

2009-04-10 Thread Scott Marlowe
2009/4/7 Stuart McGraw : > Hello all, > > I have a table with a primary key column > that contains sequential numbers. > > Sometimes I need to shift them all up or down > by a fixed amount.  For example, if I have > four rows with primary keys, 2, 3, 4, 5, I > might want to shift them down by 1 by

[SQL] Re: SQL to Check whether "AN HOUR PERIOD" is between start and end timestamps

2009-04-10 Thread Jasen Betts
On 2009-04-02, Alvaro Herrera wrote: > James Kitambara wrote: >> Dear Srikanth, >> You can solve your problem by doing this >> >> THE SQL IS AS FOLLOWS >>   ASSUME TIME INTERVAL 2008-12-07 07:59:59 TO 2008-12-07 08:58:59 AND THE >> TABLE NAME time_interval >> >>  COUNT (*) FROM   >>     (select