尝试在 DBGrid 中显示 sql 查询的结果时,出现错误:
sql 查询本身如下所示:
select Genious.*, count(Species.idG) as amount from Genious, Species where Genious.idG = Species.idG group by Genious.idG
在sql查询的“转换”之后,我仍然设法完成了任务——在DBGrid中出现了一个列,显示给定属的物种数量,但只有另一个idG列,其余列无法显示(见开头)
SQL查询“转换”:select Genious.idG, count(Species.idG) as amount from Genious, Species where Genious.idG = Species.idG group by Genious.idG
请让我走上正确的道路。我试图通过计算字段来做到这一点,但是没有足够的知识。




使用聚合函数的 sql 查询应如下所示:
因此,很明显什么
select Genious.*, count(Species.idG)是错误(因为 Group by * 是语法错误)