我需要在名爲t_npc的表中搜索列(對於特定值i
),但失敗很多次。Mysql查詢搜索
例如(不工作)
SELECT * FROM t_npc WHERE a_item_0 LIKE '%a_item_%' = 123;
SELECT * FROM t_npc WHERE 'a_item_0' <=> 'a_item_19' = 123;
SELECT a_index FROM t_npc WHERE a_item_0 LIKE 'a_item_%' = 123;
SELECT a_index, a_name FROM t_npc WHERE t_npc.a_item_0 or t_npc.a_item_1 or t_npc.a_item_2 or t_npc.a_item_4 = 44;
和許多其他搜索下面的值的列名,但它永遠不會奏效。我已經嘗試過使用這些列的通配符,但仍不幸運。
`a_item_0` int(11) NOT NULL DEFAULT '-1',
`a_item_1` int(11) NOT NULL DEFAULT '-1',
`a_item_2` int(11) NOT NULL DEFAULT '-1',
`a_item_3` int(11) NOT NULL DEFAULT '-1',
`a_item_4` int(11) NOT NULL DEFAULT '-1',
`a_item_5` int(11) NOT NULL DEFAULT '-1',
`a_item_6` int(11) NOT NULL DEFAULT '-1',
`a_item_7` int(11) NOT NULL DEFAULT '-1',
`a_item_8` int(11) NOT NULL DEFAULT '-1',
`a_item_9` int(11) NOT NULL DEFAULT '-1',
`a_item_10` int(11) NOT NULL DEFAULT '-1',
`a_item_11` int(11) NOT NULL DEFAULT '-1',
`a_item_12` int(11) NOT NULL DEFAULT '-1',
`a_item_13` int(11) NOT NULL DEFAULT '-1',
`a_item_14` int(11) NOT NULL DEFAULT '-1',
`a_item_15` int(11) NOT NULL DEFAULT '-1',
`a_item_16` int(11) NOT NULL DEFAULT '-1',
`a_item_17` int(11) NOT NULL DEFAULT '-1',
`a_item_18` int(11) NOT NULL DEFAULT '-1',
`a_item_19` int(11) NOT NULL DEFAULT '-1',
是的,我同意下面的傢伙。一個新的表格設計是爲了 – Drew 2013-05-11 05:54:18