I've a column that contain something formed by concatenating fields
from another table
create table stuff(
glued varchar(30),
...
);
insert into stuff select 'constA,' || field1 || ',' || field2 from
origin where ...;
insert into stuff select 'constB,' || field1 || ',' || field2 from
origin where ...;
I know this is terrible... but this is what I have, and I can't
change it.
Now what I'd like to do is selecting in stuff using a pattern as:
select * from stuff where glue like (
select '%,' || field1 || ',' || field2 || '%'
from origin
where ...
);
But this isn't going to work.
Any other way other than specifying all the const one by one in a
union and then look for equality?
select * from stuff where glue in (
select 'constA,' || field1 || ',' || field2 from
origin where ...
union
select 'constB,' || field1 || ',' || field2 from
origin where ...
);
--
Ivan Sergio Borgonovo
http://www.webthatworks.it