| From: | Nathan Hand <nathanh(at)wookie(dot)chirp(dot)com(dot)au> |
|---|---|
| To: | pgsql-sql(at)postgresql(dot)org |
| Subject: | LIKE query over multiple fields |
| Date: | 1999-01-06 20:49:39 |
| Message-ID: | Pine.LNX.3.96.990107074146.23443A-100000@wookie.chirp.com.au |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
I'm doing something like the following
select * from mytable
where field1 like '%pattern%' or field2 like '%pattern%';
I actually have 60+ fields so I found that the following was more
convenient even though it's not exactly the same.
select * from mytable
where (field1||field2) like '%pattern%';
My question is, can this be done in a cleaner way? Something that
works similarly to the first example by preference. I thought
select * from mytable
where * like '%pattern%';
Logically described what I wanted, but of course this didn't work
with postgresql (or any other xbase, as far as I can tell).
Please CC: responses to me, if that's convenient. I read the psql
mailing list via an archive which isn't always in sync.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tim Perdue, The Des Moines City.net | 1999-01-06 23:16:01 | Importing Fixed-Width File? |
| Previous Message | Jackson, DeJuan | 1999-01-06 19:32:27 | RE: [SQL] Kind of Funny |