mysql数据库如何搜索关键词

我的mysql 数据库的一个表 table1 中 有若干字段,我想 搜索其中一条记录包括 77 这个数值,
sql语句怎么写,多谢了。

办法如下:

select * from table1 where concat(`字段`,`字段`,`字段` ) like '%关键字%' union
select * from table2 where concat(`字段`,`字段`,`字段` ) like '%关键字%' union
select * from table3 where concat(`字段`,`字段`,`字段` ) like '%关键字%' union
select * from table4 where concat(`字段`,`字段`,`字段` ) like '%关键字%' union
select * from table5 where concat(`字段`,`字段`,`字段` ) like '%关键字%' 
前提是查询出来的字段个数要一样,类型要对应好,至于如何得到正确且符合你需要的sql就要在程序类中处理了。

温馨提示:答案为网友推荐,仅供参考
第1个回答  2015-06-08
select * from table1 where 列名1 like ‘%77%'
第2个回答  2013-07-29
select 列名 from table1 where 列名 like ‘%77%’
第3个回答  2013-07-30
select * from table1 where 列名1 like ‘%77%' or 列名2 like ‘%77%'。。。。。。。。。。。。。。。。本回答被网友采纳