Reputation: 61
I have written a SQL query which would fetch duplicates of name and size:
SELECT t1.Filepath,
t1.splitFilePath1(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(Filepath) = t2.splitFilePath1(Filepath)
In the above query,splitFilePath1(Filepath) is a user defined function which takes Filepath as the input and returns filename.After receiving filename,I have to find duplicates of filename and size.
Error received: Near'(' :Syntax error
I am unable to understand where exactly it expects the '('.
Edit:Solved!! Query: SELECT Filepath,splitFilePath1(Filepath) FROM Filemanager t1 INNER JOIN (SELECT Filepath as Filepath1,splitFilePath1(Filepath),Size FROM Filemanager GROUP BY splitFilePath1(Filepath), Size HAVING COUNT(*) > 1) t2 ON t1.Size = t2.Size AND splitFilePath1(t1.Filepath) = splitFilePath1(t2.Filepath1)
Thanks to lollato!!
Upvotes: 0
Views: 56
Reputation: 152817
Change t1.splitFilePath1(Filepath)
to splitFilePath1(t1.Filepath)
and similarly for the other occurences. t1.splitFilePath
would refer to a column in t1
and having ()
parens after it is a syntax error.
Upvotes: 1