[SQL] join table?

2008-10-28 Thread Michael Higgins
Hello, list. First post here, I think. So I've worked with several *lousy* DB engines and *poorly* designed databases behind crappy applications over these many years. I look forward to moving everything to PG. First issue is addressed. Now with the grand opportunity to be hoist upon my own pet

Re: [SQL] How to hand over array as variable in plpgsql function?

2008-10-28 Thread Tom Lane
"Jan Peters" <[EMAIL PROTECTED]> writes: >> Seems like using EXECUTE is the hardest possible way to do this. Why >> don't you just SELECT? >> >> SELECT id FROM precip_arrays WHERE b = precip_control INTO id_result; > How should the code look like to do this? Uh ... just like that. > SELECT pre

Re: [SQL] Performing intersection without intersect operator

2008-10-28 Thread Peter Eisentraut
Nacef LABIDI wrote: I want to perform an intersection between several select queries but without using the INTERSECT keyword. select userid from orders where productid=1 INTERSECT select userid from orders where productid=2 I want to transform it without the INTERSECT. (select userid from

Re: [SQL] Performing intersection without intersect operator

2008-10-28 Thread Oliveiros Cristina
Howdy, Nacef, Try this, SELECT a.userid FROM orders a JOIN orders b USING (userid) WHERE a.productid = 1 AND b.productid = 2 Best, Oliveiros - Original Message - From: Nacef LABIDI To: pgsql-sql@postgresql.org Sent: Tuesday, October 28, 2008 11:14 AM Subject: [SQL] Perfo

[SQL] Performing intersection without intersect operator

2008-10-28 Thread Nacef LABIDI
Hi all, I want to perform an intersection between several select queries but without using the INTERSECT keyword. select userid from orders where productid=1 INTERSECT select userid from orders where productid=2 I want to transform it without the INTERSECT. Thanks to all Nacef

Re: [SQL] How to hand over array as variable in plpgsql function?

2008-10-28 Thread Jan Peters
Hi Tom (and hello all again), thanks for your reply. > Seems like using EXECUTE is the hardest possible way to do this. Why > don't you just SELECT? > > SELECT id FROM precip_arrays WHERE b = precip_control INTO id_result; How should the code look like to do this? I am using EXECUTE because I