任何人都可以使用任何SQL-fu(可以是MySQL特有的),它会给我一个int中设置位的索引,而不使用过程?用程序怎么样?从mysql中的int列中获取设置位的索引
例如,给定:
create table example (val int);
insert into example values (1), (2), (3), (4), (256);
我可以看到设置位:
select conv(val, 10, 2) from example;
+------------------+
| conv(val, 10, 2) |
+------------------+
| 1 |
| 10 |
| 11 |
| 100 |
| 100000000 |
+------------------+
我需要魔法,这将使我:
+------------------+
| (something) |
+------------------+
| 1 |
| 2 |
| 1,2 |
| 3 |
| 9 |
+------------------+
..高兴能得到基于0的也是。
is this homework? – shoover 2009-11-07 00:44:47