MySQL查询时,在服务器端执行的工作,而不是客户端
**** ***解决方案MySQL查询时,在服务器端执行的工作,而不是客户端
我在双引号来代替单引号包裹查询。
如果我登录到下面的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不是列,而是列基因符号中的id。
为什么当我登录到服务器时查询工作正常,但是当我以第二种方式运行时,查询不起作用?
简单 - 您要关闭“引用”太早:
-e 'select distinct c.name,c.transcript from (select distinct kgID,genesymbol,refseq from kgXref where genesymbol = 'GLRA1')
的“前GLRA1
只会在select
关键字之前关闭开引号。
谢谢。如此明显! – brucezepplin 2014-11-08 16:50:56
等待 - 我删除了单引号,仍然得到相同的错误。在服务器端运行时删除单引号现在会产生此错误 – brucezepplin 2014-11-08 17:17:36
看看你在第二个版本中用单引号包装查询的方式。 – 2014-11-08 16:47:05