am new to Mysql
我是Mysql的新手
I want to retrieve all the columns containing StrainName=M18 from the database , but am getting error. please help me in this
我想从数据库中检索包含StrainName = M18的所有列,但是收到错误。请帮帮我
SELECT *
strain.strainName,
feature.contigId,
feature.startPosition,
feature.stopPosition,
feature.orfId,
feature.orfType,
feature.funcClassification,
feature.rastId,
feature.strand
from feature,strain
where feature.id=strain.id and strainName='M18';
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 'strain.strainName,feature.contigId,feature.startPosition,feature.stopPosition,fe' at line 1
错误1064(42000):您的SQL语法有错误;查看与您的MySQL服务器版本对应的手册,以便在第1行的'strain.strainName,feature.contigId,feature.startPosition,feature.stopPosition,fe'附近使用正确的语法
2 个解决方案
#1
1
you need add comma after *
你需要在*之后添加逗号
SELECT *, -- <<====== HERE
strain.strainName,
feature.contigId,
feature.startPosition,
feature.stopPosition,
feature.orfId,
feature.orfType,
feature.funcClassification,
feature.rastId,
feature.strand
from feature,strain
where feature.id=strain.id and
strainName='M18';
#2
1
to get all columns:
获取所有列:
SELECT * from feature,strain
where feature.id=strain.id and strainName='M18';
to get specific columns :
获取特定列:
SELECT
strain.strainName,
feature.contigId,
feature.startPosition,
feature.stopPosition,
feature.orfId,
feature.orfType,
feature.funcClassification,
feature.rastId,
feature.strand
from feature,strain
where feature.id=strain.id and
strainName='M18';
#1
1
you need add comma after *
你需要在*之后添加逗号
SELECT *, -- <<====== HERE
strain.strainName,
feature.contigId,
feature.startPosition,
feature.stopPosition,
feature.orfId,
feature.orfType,
feature.funcClassification,
feature.rastId,
feature.strand
from feature,strain
where feature.id=strain.id and
strainName='M18';
#2
1
to get all columns:
获取所有列:
SELECT * from feature,strain
where feature.id=strain.id and strainName='M18';
to get specific columns :
获取特定列:
SELECT
strain.strainName,
feature.contigId,
feature.startPosition,
feature.stopPosition,
feature.orfId,
feature.orfType,
feature.funcClassification,
feature.rastId,
feature.strand
from feature,strain
where feature.id=strain.id and
strainName='M18';