SQL Where ANY 列等于一个值 [英] SQL Where ANY column equals a value
本文介绍了SQL Where ANY 列等于一个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以在 MySQL 中选择任何列包含指定值的所有行?
Is it possible in MySQL to select all rows where ANY column contains a specified value?
我正在尝试编写一个通用搜索函数,该函数无需任何表架构信息即可工作.
I'm trying to write a generic search function that can work without any information about a table schema.
推荐答案
使用 SHOW COLUMNS
获取表中列的列表,然后根据结果动态构建查询.
Use SHOW COLUMNS
to get a list of the columns in the table and then dynamically build your query from the results.
这篇关于SQL Where ANY 列等于一个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文