snowboardr
Programmer
I am trying to do a count subquery but am not very good at these...
I have two tables: privatemessage, userfolders
I am not very good with group by... and thats what error i am getting:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GROUP By pfolder' at line 1
If you need folder explanation let me know.
I have two tables: privatemessage, userfolders
I am not very good with group by... and thats what error i am getting:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GROUP By pfolder' at line 1
If you need folder explanation let me know.
Code:
SELECT
f.fid,
f.fuid,
f.fname,
(SELECT COUNT(ptoid) as intFolderCount,pfolder
FROM privatemessage
WHERE ptoid=2 AND pfolder=f.fid)
FROM userfolders as f WHERE fuid=2
ORDER by fname ASC GROUP By pfolder