[GENERAL] using EXISTS instead of IN: how?

2003-07-22 Thread Rory Campbell-Lange
I have been informed that at present (postgres 7.3.2) using IN is not advised, and I should replace it with EXISTS. I can't seem to get it to work. I've tried replacing (example): SELECT name FROM people WHERE state IN ( SELECT id

Re: [GENERAL] using EXISTS instead of IN: how?

2003-07-22 Thread Csaba Nagy
You should use something like: SELECT name FROM people p WHERE exists ( SELECT 1 FROM states WHERE name = p.state ) AND state ~* 'r'; On Tue,

Re: [GENERAL] using EXISTS instead of IN: how?

2003-07-22 Thread DeJuan Jackson
Rory Campbell-Lange wrote: I have been informed that at present (postgres 7.3.2) using IN is not advised, and I should replace it with EXISTS. I can't seem to get it to work. I've tried replacing (example): SELECT name FROM people WHERE state IN ( SELECT

Re: [GENERAL] using EXISTS instead of IN: how?

2003-07-22 Thread Mike Mascari
Rory Campbell-Lange wrote: I have been informed that at present (postgres 7.3.2) using IN is not advised, and I should replace it with EXISTS. I can't seem to get it to work. ... SELECT name FROM people WHERE exists ( SELECT

Re: [GENERAL] using EXISTS instead of IN: how?

2003-07-22 Thread Felipe Schnack
Why using IN is not advisable??? On 22 Jul 2003 18:36:10 +0200 Csaba Nagy [EMAIL PROTECTED] wrote: You should use something like: SELECT name FROM people p WHERE exists ( SELECT 1 FROM

Re: [GENERAL] using EXISTS instead of IN: how?

2003-07-22 Thread Csaba Nagy
Actually, even better: select name from people p, states s where p.state = s.name and p.state ~* 'r'; Cheers, Csaba. On Tue, 2003-07-22 at 18:36, Csaba Nagy wrote: You should use something like: SELECT name FROM people p WHERE exists (

Re: [GENERAL] using EXISTS instead of IN: how?

2003-07-22 Thread Mike Mascari
Felipe Schnack wrote: Why using IN is not advisable??? http://www.postgresql.org/docs/faqs/FAQ.html#4.22 But I believe Tom has fixed this for the upcoming 7.4. Mike Mascari [EMAIL PROTECTED] ---(end of broadcast)--- TIP 1: subscribe and