我有一个查询,可以通过名称和大小获取重复。名称将由用户定义的函数splitFilePath1(Filepath)
检索,其中Filepath
是表的列.Below是我的查询
SELECT Filepath,splitFilePath1(t1.Filepath) FROM Filemanager t1 INNER JOIN (SELECT splitFilePath1(Filepath),Size FROM Filemanager GROUP BY splitFilePath1(Filepath), Size HAVING COUNT(*) > 1) t2 ON t1.Size = t2.Size AND t1.splitFilePath1 = t2.splitFilePath1
错误:找不到t1.splitFilePath1。
编辑1:
SELECT splitFilePath1(Filepath) FROM Filemanager t1 INNER JOIN (SELECT Size,splitFilePath1(Filepath) FROM Filemanager GROUP BY splitFilePath1(Filepath),Size HAVING count(*) > 1) t2 ON splitFilePath1(t1.Filepath)= splitFilePath1(t2.Filepath) AND t1.Size=t2.Size
错误:找不到文件路径。
答案 0 :(得分:0)
猜猜在查询结尾处t1.splitFilePath1
应该替换为splitFilePath1(t1.Filepath)
。我认为该表没有列
答案 1 :(得分:0)
在您的(第一个)查询中,t2
不是表而是子查询,因此只有当该列出现在该SELECT列表中时,才能访问列t2.xxx
。
要访问splitFilePath1(Filepath)
的值,请为其命名:
SELECT Filepath,
splitFilePath1(t1.Filepath)
FROM Filemanager t1
INNER JOIN (SELECT splitFilePath1(Filepath) AS splitFilepath,
Size
FROM Filemanager
GROUP BY splitFilePath1(Filepath),
Size
HAVING COUNT(*) > 1) t2
ON t1.Size = t2.Size AND
splitFilePath1(t1.Filepath) = t2.splitFilepath