On Tue, 2002-11-05 at 08:56, Brad Smith wrote:
> I want to run a query that will perform a phrase search on all fields in 
> the table.

I think the best approach would be to construct a view that normalizes
this table.  Given:

create table foo (pkey integer primary key, aaa text, bbb text, ccc
text);


I would create a view that looked like this:

create view regular_foo as
select pkey, 'aaa' as col_type, aaa as col
from foo
union
select pkey, 'bbb' as col_type, bbb as col
from foo
union
select pkey, 'ccc' as col_type, ccc as col
from foo;


Now you can search all the text columns via

select * from regular_foo where col like '%pattern%';


-- 
Jeff Boes                                      vox 616.226.9550 ext 24
Database Engineer                                     fax 616.349.9076
Nexcerpt, Inc.                                 http://www.nexcerpt.com
           ...Nexcerpt... Extend your Expertise

Reply via email to