****解决方案***
我不得不用双引号而不是单引号来包装查询。
如果我登录到以下mysql服务器:
mysql --user=genome --host=genome-mysql.cse.ucsc.edu -A
然后运行以下查询:
select distinct
kgID, genesymbol, refseq
from
kgXref
where
genesymbol = 'GLRA1') a
inner join
(select * from knownGene) b on a.kgID = b.name
inner join
(select distinct
name, transcript, chromStart, chromEnd,
substr(peptides, 1, 1) as ref_pep,
substr(peptides, 3, 1) as mut_pep
from
snp137CodingDbSnp) c on a.refseq = c.transcript
我得到了我想要的结果。
但是,如果我按以下方式运行:
mysql --user=genome --host=genome-mysql.cse.ucsc.edu -A hg19 -D hg19 -e 'select distinct c.name,c.transcript from (select distinct kgID,genesymbol,refseq from kgXref where genesymbol = 'GLRA1') a inner join (select * from knownGene) b on a.kgID = b.name inner join (SELECT distinct name, transcript,chromStart,chromEnd, substr(peptides,1,1) as ref_pep,substr(peptides,3,1) as mut_pep FROM snp137CodingDbSnp) c on a.refseq = c.transcript'
我收到以下错误
ERROR 1054(42S22)第1行:未知栏' GLRA1'在' where子句'
其中GLRA1不是列,而是列geneSymbol中的id。
为什么我登录服务器时查询有效,但是当我以第二种方式运行时却没有?
答案 0 :(得分:1)
简单 - 你太早关闭“引用”:
-e 'select distinct c.name,c.transcript from (select distinct kgID,genesymbol,refseq from kgXref where genesymbol = 'GLRA1')
'GLRA1
之前将关闭select
关键字之前的开场报价。