Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.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
Sql 多重语法错误_Sql_Sqlite - Fatal编程技术网

Sql 多重语法错误

Sql 多重语法错误,sql,sqlite,Sql,Sqlite,因此,我基本上有一个父表(parent,child)表,并试图获得这对非父关系 我想我的语法是多重的 使用tb1作为(),tb2作为() 选择* 从…起 哪里 但是输出仍然运行syntax errorerror:near“,”:syntax error 我已经盯着这段代码看了很长时间了,所以我可以得到一些关于我语法错误的提示吗 @GordonLinoff在MySQL中没有带子句的。可能用替换其中d1.name=great,d2.name=great,其中d1.name=great和d2.n

因此,我基本上有一个
父表(parent,child)
表,并试图获得这对非父关系

我想我的语法是多重的

使用tb1作为(),tb2作为()
选择*
从…起
哪里

但是输出仍然运行syntax error
error:near“,”:syntax error


我已经盯着这段代码看了很长时间了,所以我可以得到一些关于我语法错误的提示吗

@GordonLinoff在MySQL中没有带子句的
。可能用
替换
其中d1.name=great,d2.name=great
,其中d1.name=great和d2.name=great
?我真傻!!!!非常感谢你救了我一命!!我对sql非常陌生,我很好奇有没有更好的方法来调试sql,而不是盯着有时模棱两可的错误消息?@jen007。从一个简单的查询开始,一次添加一个子句和条件。@GordonLinoff MySQL中没有带子句的
where d1.name=great,d2.name=great
替换为
where d1.name=great和d2.name=great
?我真傻!!!!非常感谢你救了我一命!!我对sql非常陌生,我很好奇有没有更好的方法来调试sql,而不是盯着有时模棱两可的错误消息?@jen007。从一个简单的查询开始,一次添加一个子句和条件。
create table non_parents as
  with
    grandparents(grandfather, grandson) as (
      select a.parent, b.child from parents as a, parents as b
      where a.child = b.parent UNION
      select grandfather, child from grandparents, parents
      where grandson = parent
      ),
    greatparents(greatest, great) as (
      select grandfather, grandson from grandparents UNION
      select grandson, grandfather from grandparents
      )
  select greatest, great from greatparents, dogs d1, dogs d2
  where d1.name = greatest, d2.name = great
  order by d1.height - d2.height;