我正在尝试执行此SQL命令:
SELECT page.page_namespace, pagelinks.pl_namespace, COUNT(*) FROM page, pagelinks WHERE (page.page_namespace <=3 OR page.page_namespace = 12 OR page.page_namespace = 13 ) AND (pagelinks.pl_namespace <=3 OR pagelinks.pl_namespace = 12 OR pagelinks.pl_namespace = 13 ) AND (page.page_is_redirect = 0) AND pagelinks.pl_from = page.page_id GROUP BY (page.page_namespace, pagelinks.pl_namespace) ;
当我这样做时,我收到以下错误:
ERROR: could not identify an ordering operator for type record HINT: Use an explicit ordering operator or modify the query. ********** Error ********** ERROR: could not identify an ordering operator for type record SQL state: 42883 Hint: Use an explicit ordering operator or modify the query.
我已经尝试添加:ORDER BY(page.page_namespace,pagelinks.pl_namespace)ASC到查询结束但没有成功.
更新:
我也试过这个:
SELECT page.page_namespace, pagelinks.pl_namespace, COUNT(*) FROM page, pagelinks WHERE pagelinks.pl_from = page.page_id GROUP BY (page.page_namespace, pagelinks.pl_namespace) ;
但我仍然得到同样的错误.
谢谢
我没有检查过任何文档,但你GROUP BY
在括号中表达的事实对我来说并不常见.如果你不在这里使用括号会怎么样?