mysql> select status_flag AS status, status_flag AS status_flag from
table_name where ID = nnnn;
+--------+-------------+
| status | status_flag |
+--------+-------------+
| n | n |
+--------+-------------+
1 row in set (0.00 sec)
//ふつー
mysql> select distinct status_flag AS status, status_flag AS status_flag
from table_name where ID = n;
+-------------+-------------+
| status_flag | status_flag |
+-------------+-------------+
| n | n |
+-------------+-------------+
1 row in set (0.00 sec)
//おい!
mysql> select distinct status_flag AS status, status_flag AS status_flag
from table_name limit 1;
+--------+-------------+
| status | status_flag |
+--------+-------------+
| n | n |
+--------+-------------+
1 row in set (0.00 sec)
//こっちはふつー?
mysql>
おかしい。明らかにおかしい。
なんでdistinctとかwhereつけるだけでasの名前が無視されるんだ?
table_name where ID = nnnn;
+--------+-------------+
| status | status_flag |
+--------+-------------+
| n | n |
+--------+-------------+
1 row in set (0.00 sec)
//ふつー
mysql> select distinct status_flag AS status, status_flag AS status_flag
from table_name where ID = n;
+-------------+-------------+
| status_flag | status_flag |
+-------------+-------------+
| n | n |
+-------------+-------------+
1 row in set (0.00 sec)
//おい!
mysql> select distinct status_flag AS status, status_flag AS status_flag
from table_name limit 1;
+--------+-------------+
| status | status_flag |
+--------+-------------+
| n | n |
+--------+-------------+
1 row in set (0.00 sec)
//こっちはふつー?
mysql>
おかしい。明らかにおかしい。
なんでdistinctとかwhereつけるだけでasの名前が無視されるんだ?
コメントする