Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
sqlpgadmin_Sql_Postgresql_Join - Fatal编程技术网

sqlpgadmin

sqlpgadmin,sql,postgresql,join,Sql,Postgresql,Join,以下查询提供了一个语法错误: Select traseu_stud.An, traseu_stud.CodSpec from traseu_stud where NumePren = "Popescu W.T. Vasile" and AnUniv = "2012-2013" inner join studenti on traseu_stud.matricol = studenti.matricol inner join persoane on s

以下查询提供了一个语法错误:

Select 
  traseu_stud.An, 
  traseu_stud.CodSpec 
from 
  traseu_stud 
where 
  NumePren = "Popescu W.T. Vasile" 
  and AnUniv = "2012-2013" 
  inner join studenti on traseu_stud.matricol = studenti.matricol 
  inner join persoane on studenti.idPers = persoane.idPers
错误:“内部”处或附近的语法错误
第3行:…Pren=“Popescu W.T.Vasile”和AnUniv=“2012-2013”内部连接。。。
^
SQL状态:42601
字符:122

如果要以这种方式使用筛选器,则必须使用子查询:

select * from
   (
      Select traseu_stud.An,traseu_stud.CodSpec,matricol 
      from traseu_stud 
      where NumePren='Popescu W.T. Vasile' and AnUniv='2012-2013'
   ) a
inner join studenti on a.matricol=studenti.matricol 
inner join persoane on studenti.idPers=persoane.idPers
否则,您必须使用下面的过滤器

 Select traseu_stud.An,traseu_stud.CodSpec from 
 traseu_stud  inner join 
 studenti on traseu_stud.matricol=studenti.matricol inner join persoane on 
 studenti.idPers=persoane.idPers
 where NumePren='Popescu W.T. Vasile' and AnUniv='2012-2013'

JOIN
进入from子句

另外:字符串常量需要括起来,双引号用于标识符:

Select 
  traseu_stud.An, 
  traseu_stud.CodSpec 
from traseu_stud 
  inner join studenti on traseu_stud.matricol = studenti.matricol 
  inner join persoane on studenti.idPers = persoane.idPers
where NumePren = 'Popescu W.T. Vasile'
  and AnUniv = '2012-2013'

谢谢你的帮助,但我也有同样的错误,我把图片和表格放在这里,以及我想做的事情:什么专业(Specialize)和在什么研究年度(AnUniv)2012-2013年的Popescu W.T.Vasile。

我们需要查看查询的代码考虑者:您认为您撰写此文章的权威理由是什么?你可以用什么样的方式来表达你想要的,就像你参考资料中的例子&你显然可以找到理由?