mysql从列名等于的表中选择

时间:2014-03-19 15:33:06

标签: mysql

我有一张简单的表

amps | 120-240 | 120-208 | 277-480
__________________________________

10   |  $99.00  | $149.00 | $344.00

20   | $199.00 | $298.00 | $688

我想要一个像这样的查询,但我无法让它工作......

select * from `table` where amps like '10' and column_name like '120-208';

select * from `table` where amps like '20' and column_name like '277-480';

请帮忙!也许我忽略了一种更简单的方法来设置它?

谢谢!

1 个答案:

答案 0 :(得分:0)

就像这样?

SELECT `120-208` FROM table WHERE amps = '10'