Re: [GENERAL] How to fetch rows with multiple values

2006-01-20 Thread Keary Suska
on 1/20/06 9:08 AM, [EMAIL PROTECTED] purportedly said: > No, because I need AND operator between the terms. > > Thanks anyway :) Got it. Being thick. Just so I can save face, it may be more efficient to do: SELECT (min("ID") = avg("ID)) AS result, min("ID") as "ID" FROM customer_mapping WHERE

Re: [GENERAL] How to fetch rows with multiple values

2006-01-20 Thread Richard Huxton
Keary Suska wrote: Data looks something like this: "john" 1 "peter"1 Maybe I'm a little thick this morning but can't you just do: SELECT "ID" from customer_mapping WHERE "Name"='john' OR "Name"='peter' OR "Name"='george' ORDER BY "ID" DESC Not quite. He's after ID that have *both

Re: [GENERAL] How to fetch rows with multiple values

2006-01-20 Thread Sebastjan Trepca
No, because I need AND operator between the terms. Thanks anyway :)SebastjanOn 1/20/06, Keary Suska < [EMAIL PROTECTED]> wrote:on 1/20/06 6:19 AM, [EMAIL PROTECTED] purportedly said:> I have a table like this:>> CREATE TABLE customer_mapping> (> "Name" varchar(128) NOT NULL,> "ID" int8 NOT NULL >

Re: [GENERAL] How to fetch rows with multiple values

2006-01-20 Thread Keary Suska
on 1/20/06 6:19 AM, [EMAIL PROTECTED] purportedly said: > I have a table like this: > > CREATE TABLE customer_mapping > ( > "Name" varchar(128) NOT NULL, > "ID" int8 NOT NULL > ) > > Data looks something like this: > > "john" 1 > "peter"1 > "test" 2 > "george" 3 > > What I woul

Re: [GENERAL] How to fetch rows with multiple values

2006-01-20 Thread Sebastjan Trepca
Wow, this joined query is super faster then intersect(10x), thanks a lot!!Regarding that I have to make a join for every term, I would think it would be more consuming. Is there any limit of joins or something similar which I should be aware of? SebastjanOn 1/20/06, Michael Glaesemann <[EMAIL PROTE

Re: [GENERAL] How to fetch rows with multiple values

2006-01-20 Thread Michael Glaesemann
On Jan 20, 2006, at 22:19 , Sebastjan Trepca wrote: What I would like is to write a query where I can specify multiple names and get the IDs which have them. For now it seems the most efficient way is to use INTERSECT statement: SELECT "ID" from customer_mapping WHERE "Name"='john' INTERSEC

[GENERAL] How to fetch rows with multiple values

2006-01-20 Thread Sebastjan Trepca
Hi,I have a table like this:CREATE TABLE customer_mapping(  "Name" varchar(128) NOT NULL,  "ID" int8 NOT NULL) Data looks something like this:"john" 1 "peter"    1"test"  2"george"  3What I would like is to write a query where I can specify multiple names and get the IDs which have them.For