tags:

views:

345

answers:

2

I have a table, contacts, that has a dozen columns or so. I want to identify each row in which at least one column contains a regular expression. I'm wondering if it's possible to do something like this:

select * from contacts where * like '%re%';

instead of this:

select * from contacts where last_name like '%re%' or first_name like '%re%' or ... ;

Is this possible?

+1  A: 

I don't think that's possible. Perhaps you could put a trigger on the table to update a single denormalized column?

Chase Seibert
Thanks. I think you're right. I was able to construct the query in Python easily enough.
Tony
+1  A: 
select * from contacts where concat(last_name, ' ', first_name) like '%re%'
longneck
Interesting. This isn't quite what I was looking for (I have 10+ columns for various fields), but this is good to know.
Tony