开发者

Select multiple like named fields with expression

开发者 https://www.devze.com 2023-03-25 17:36 出处:网络
So I have like fields like: Home Zip Business Zip Mailing Zip How could I do 开发者_StackOverflow社区something like this (match any field that has Zip):

So I have like fields like:

  • Home Zip
  • Business Zip
  • Mailing Zip

How could I do 开发者_StackOverflow社区something like this (match any field that has Zip):

SELECT ILIKE "%Zip"
FROM db_tbl
WHERE condition = 'foo'


Here is a good answer to your question:

stackoverflow.com/questions/5274594/

To summarize, standard SQL doesn't quite support that functionality, but you can get it somewhat working with a little work.


You can't. You can chain multiple LIKE statements with an OR, but SQL deals with data and not metadata, so there is no shortcut to 'search any field with X string for blah' anywhere in the SQL specification (or any SQL derivative I have ever used).

0

精彩评论

暂无评论...
验证码 换一张
取 消