开发者

Select multiple like named fields with expression

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜