[SQL] triple self-join crawling

2007-03-18 Thread T E Schmitz
The following self join of a table containing 5800 records is crawling: CREATE TABLE history ( stock VARCHAR(30) NOT NULL, day date NOT NULL, open NUMERIC (6,1) NOT NULL, high NUMERIC (6,1) NOT NULL, low NUMERIC (6,1) NOT NULL, close NUMERIC (6,1) NOT NULL, volume

[SQL] better approach: case or join

2007-03-18 Thread chester c young
from id extracting name from several tables. which is generally the better approach? select case when tab_tla='usr' then (select name from users where ... ) case when tab_tla='con' then (select title from contents where ...) endas name; as versus select name fromusers where

[SQL] Help with sub query

2007-03-18 Thread roopa perumalraja
Hi all, I want the last value from the group of rows. The table 'index_prices' is index_code price_time price XYZ09:45:00 7.5 XYZ09:46:00 7.4 XYZ09:59:00 7.2 XYZ10:00:00 7.3 XYZ10:01:00 7.6 XYZ

Re: [SQL] Help with sub query

2007-03-18 Thread Phillip Smith
Add something like this to your query: ORDER BY price_time LIMIT 1 Cheers, ~p -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of roopa perumalraja Sent: Monday, 19 March 2007 13:56 To: pgsql-sql@postgresql.org Subject: [SQL] Help with sub query

[SQL] create view with check option

2007-03-18 Thread Karthikeyan Sundaram
Hi Everybody, I have 2 versions of postgres 8.1.0 is my production version and 8.2.1 is my development version. I am trying to create a view in my development version (8.2.3) create view chnl_vw as select * from channel with check option; I am getting an error message: [Error]

Re: [SQL] create view with check option

2007-03-18 Thread Tom Lane
Karthikeyan Sundaram [EMAIL PROTECTED] writes: I am getting an error message: ERROR: WITH CHECK OPTION is not implemented what does this mean? It seems perfectly clear to me ... regards, tom lane ---(end of