Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 jet sql syntax error in multiple join

Author  Topic 

workindan
Starting Member

21 Posts

Posted - 2012-01-09 : 12:20:25
Can anyone spot the syntax error? I wouldn't have a problem in SQL Server, but Jet SQL in Access is giving me a headache...can't seem to get the subquery to work even though both queries work on their own.

-------

SELECT dbo_MSMYB_Contacts.UserID, dbo_MSMYB_Contacts.FirstName, dbo_MSMYB_Contacts.LastName, dbo_MSMYB_Contacts.FLL,
count(tmpDB2Run.Category) as Inquiries, count(tmpDB2Run.Drug_Reason) as templates, A.Calls
FROM dbo_MSMYB_Contacts
INNER JOIN tmpDB2Run
ON dbo_MSMYB_Contacts.UserID = tmpDB2Run.CreatedBy
INNER JOIN
(SELECT dbo_MSMYB_Contacts.UserID, sum(root_dagent.acdcalls) as [Calls]
FROM dbo_MSMYB_Contacts INNER JOIN root_dagent ON dbo_MSMYB_Contacts.Extension = root_dagent.logid
WHERE root_dagent.row_date>=#1/2/2012# And root_dagent.row_date<#1/8/2012#
AND (root_dagent.split = 1213 OR root_dagent.split = 1257 OR root_dagent.split = 1258)
GROUP BY UserID;
) as A
ON dbo_MSMYB_Contacts.UserID = A.UserID
GROUP BY dbo_MSMYB_Contacts.UserID, dbo_MSMYB_Contacts.FirstName, dbo_MSMYB_Contacts.LastName, dbo_MSMYB_Contacts.FLL;

X002548
Not Just a Number

15586 Posts

Posted - 2012-01-09 : 12:22:03
You mean M$ Access

I don't think Access supports derived tables

What version are you using?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

workindan
Starting Member

21 Posts

Posted - 2012-01-09 : 12:29:45
I usually work in SS but this one I'm doing in MS Access, yes :P

Right now it's MS Access Version 14.0.47600.1000 (32-bit)
Go to Top of Page
   

- Advertisement -