显示从MySQL的另一列引用的列内容

时间:2018-08-30 01:57:58

标签: mysql sql mysql-python

我有一个名为ant的表,其中包含以下内容:

contents of table ants

现在,我想查看列phone_info的内容,该列的ID例如为onexT1。我尝试使用:

SELECT phone_info WHERE id="onexT1" FROM ants;

但返回错误:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE id="onexT1" FROM  ants' at line 1

我该怎么做?谢谢:)

1 个答案:

答案 0 :(得分:0)

使用单引号:

SELECT phone_info WHERE id = 'onexT1' FROM ants;