简体   繁体   English

SQL选择查询不返回某些列

[英]sql select query not returning for some columns

I am developing a web app using gwt. 我正在使用gwt开发一个Web应用程序。 As part of the app I have created table that has 4 columsn: id, name, code, file. 作为应用程序的一部分,我创建了具有4列的表:id,名称,代码,文件。 From some reason when I run the command 由于某种原因,当我运行命令

"SELECT * FROM myTABLE WHERE id = 3"

MAMP returns a result but when I run MAMP返回结果,但是当我运行时

"SELECT * FROM myTABLE WHERE code = 'A101'"

MAMP does not return anything and instead just shows a spinning loading icon. MAMP不返回任何内容,而是显示一个正在旋转的加载图标。 The same command works for the name column but does not work for the file column 相同的命令适用于名称列,但不适用于文件列

Edit: 编辑:

I added an index for code 我为代码添加了索引

Code is a reserved word in MySQL. Code是MySQL中的保留字。 You should use back ticks around it. 您应该在其周围使用回勾。

"SELECT * FROM myTABLE WHERE `code` = 'A101'"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM