Re: [SQL] Standard syntax?

2000-10-12 Thread Tomas Berndtsson
"Franz J Fortuny" <[EMAIL PROTECTED]> writes: > I have been using (with success) this SQL statement in PostgreSQL: > > select col1, > case when col2 = true then > col3 > else > col4 > end as colw, > colM > where etc. > > The above syntax, however, does no

Re: [SQL]

2000-10-23 Thread Tomas Berndtsson
[EMAIL PROTECTED] writes: > Hello, > I have following problem with PostgreSQL 6.5.3, I haven't possiblity > to check it on 7.0 and I want to know is it possible to run such query: > > SELECTk.pic, id_g, id_k, count(*) > FROM kart k, pictues p > WHERE k.pic = p.pic > GROUP BY k.pic > >

Re: [SQL] knowing which columns have beend UPDATEd inside a TRIGGER?

2000-10-25 Thread Tomas Berndtsson
Tom Lane <[EMAIL PROTECTED]> writes: > Louis-David Mitterrand <[EMAIL PROTECTED]> writes: > > Is there a way to know which columns are being UPDATEd or INSERTEd from > > inside a trigger, either in C or pl/pgsql? > > Huh? An INSERT always inserts all columns, by definition. Some of them > migh

Re: [SQL] Query Problem

2000-10-26 Thread Tomas Berndtsson
Josh Berkus <[EMAIL PROTECTED]> writes: > Folks: > > Here's the problem, in abstract: I need to select every record in table > A that does not have a link in table B Join Table C where Table > C.account = 11 > > The relevant fields: > > Table_A > CaseID > Data > > Table_B > GroupID > CaseID

Re: [SQL] SELECT FROM t1 WHERE id IN (SELECT id FROM t2 UNION SELECT id FROM t3)

2000-11-10 Thread Tomas Berndtsson
Tom Lane <[EMAIL PROTECTED]> writes: > Christophe Boyanique <[EMAIL PROTECTED]> writes: > > SELECT idProduct FROM products > > WHERE idProduct IN > > (SELECT id FROM orders WHERE ts>'2000-10-01 17:04:00' > > UNION SELECT id FROM preorders WHERE ts>'2000-10-01 17:04:00') > > ORDER by n

Re: [SQL] Trouble with subqueries

2001-01-19 Thread Tomas Berndtsson
Jussi Vainionpää <[EMAIL PROTECTED]> writes: > SELECT name, length, fives > FROM movies, >(SELECT name as rname, >count(*) as fives > FROM ratings > WHERE rating='5' > GROUP BY name) > WHERE name=rname; > > but in PostgreSQL 7 it just giv

Re: [SQL] optimizing select ... not in (select ...)

2001-08-13 Thread Tomas Berndtsson
Laurent Martelli <[EMAIL PROTECTED]> writes: > I have this query : > > select distinct on (Pictures.PictureID) * from Pictures where Pictures.PictureID not >in (select distinct PictureID from Keywords); > > and I find it a bit slow. Does anybody have suggestions to run this > faster ? (I have

[SQL] index usage for query

2002-11-19 Thread Tomas Berndtsson
Hi, I have a question about index usage in PostgreSQL 7.2.1 on Solaris. I have three tables like this: port: element text portnoint primary key: element, portno index: element port_s: element text portnoint sname text pri int primary key: elem

[SQL] Big query problem

2002-11-27 Thread Tomas Berndtsson
I'm using 7.2.1, trying to run a query like this: DELETE FROM table WHERE col1='something' AND col2 IN ('aasdoijhfoisdfsdoif','sdfsdfsdfsadfsdf', ... ); In the parantheses I have 6400 names, each about 20 characters. I'm using libpq from C. This did not work very well, but the result was very une