From: | Harald Fuchs <hari(dot)fuchs(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: selecting recs based on a tmp tbl vals that are wildcarded ? |
Date: | 2009-01-08 16:28:16 |
Message-ID: | pu8wplwyn3.fsf@srv.protecting.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
In article <482E80323A35A54498B8B70FF2B8798003E5AC7099(at)azsmsx504(dot)amr(dot)corp(dot)intel(dot)com>,
"Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com> writes:
> I have a temp table containg wildcarded strings and I want to select values
> froma different table using ?like? against all those wildcarded values. Here?s
> the example...
> create temporary table match_these (val varchar(32));
> insert into match_these (val) values (?jo%?);
> insert into match_these (val) values (?%denn_?);
> insert into match_these (val) values (?alt%?);
> create table footable (name varchar(32));
> (insert a bunch of records)
> Now...
> select * from footable where name in (select val from match_these)
> ... won?t work because ?in? implies equality. I want something like...
> select * from footable where name like (select val from match_these)
Why don't you use a simple join? Something like
SELECT f.name
FROM footable f
JOIN match_these m ON f.name ~~ m.val
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Huxton | 2009-01-08 16:31:35 | Re: Cannot restart postgresql when increasing max_connections |
Previous Message | Harald Armin Massa | 2009-01-08 16:20:58 | Re: version number between pgdump and server |