G
Guest
I have a query with a sub query that works fine in MS Access. However I get
an error when trying the same query in .Net AccessDataSource Query Builder.
I get the error when I place open parenthesis at the start of the sub query
(Select statement and then the close parenthesis at the end of the sub query
GROUP BY [Account]).
The error I receive is:
Error in SELECT clause: expression near 'SELECT'.
Error in SELECT clause: expression near 'FROM'.
Missing FROM clause.
Unable to parse query text.
The query is as follows:
--------Start Query-----
SELECT Mailboxes.[Key], Mailboxes.BoxNumber, Mailboxes.LastName,
Mailboxes.PhoneNumber, Mailboxes.DirectoryListing, Mailboxes.[Password],
Mailboxes.FirstName, Mailboxes.BoxStatus,
MailboxStatusXref.BoxStatusDescription, Mailboxes.Flags,
Mailboxes.MaxNewMessages,
Mailboxes.MaxSavedMessages,
Mailboxes.MaxMessageLength, Mailboxes.MaxMessageAge,
Mailboxes.GreetingFileID, Mailboxes.NameFileID,
Mailboxes.NotificationID, Mailboxes.NewMessageCount,
Mailboxes.SavedMessageCount, Mailboxes.NoAnswerRetryTime,
Mailboxes.NoOwnerRetryTime, Mailboxes.BusyRetryTime,
Mailboxes.NoAnswerRetryCount, Mailboxes.NoOwnerRetryCount,
Mailboxes.BusyRetryCount, Mailboxes.NotifyDelay,
Mailboxes.ConfirmTime, Mailboxes.ProficiencyLevel, Mailboxes.Gender,
Mailboxes.AlarmTriggerCount, Mailboxes.EMAILAddress,
Mailboxes.MiddleName, Mailboxes.OutOfOfficeFileID,
MailboxUserLoginXref.UserLogin,
MailboxStatusXref.BoxStatusNumber,
MailboxUserLoginXref.[Key] AS Expr1, MailboxUserLoginXref.BoxNumber AS Expr2,
(SELECT COUNT([Status])
FROM Message
WHERE ([Mailboxes.BoxNumber] =
[Message.Account] AND [Status] = N)
GROUP BY [Account]) AS ExprN
(SELECT COUNT([Status])
FROM Message
WHERE ([Mailboxes.BoxNumber] =
[Message.Account] AND [Status] = S)
GROUP BY [Account]) AS ExprS
FROM (((Mailboxes INNER JOIN
MailboxUserLoginXref ON Mailboxes.BoxNumber =
MailboxUserLoginXref.BoxNumber) INNER JOIN
MailboxStatusXref ON Mailboxes.BoxStatus =
MailboxStatusXref.BoxStatusNumber) LEFT OUTER JOIN
Message ON Mailboxes.BoxNumber = Message.Account)
GROUP BY Mailboxes.[Key], Mailboxes.BoxNumber, Mailboxes.LastName,
Mailboxes.PhoneNumber, Mailboxes.DirectoryListing, Mailboxes.[Password],
Mailboxes.FirstName, Mailboxes.BoxStatus,
MailboxStatusXref.BoxStatusDescription, Mailboxes.Flags,
Mailboxes.MaxNewMessages,
Mailboxes.MaxSavedMessages,
Mailboxes.MaxMessageLength, Mailboxes.MaxMessageAge,
Mailboxes.GreetingFileID, Mailboxes.NameFileID,
Mailboxes.NotificationID, Mailboxes.NewMessageCount,
Mailboxes.SavedMessageCount, Mailboxes.NoAnswerRetryTime,
Mailboxes.NoOwnerRetryTime, Mailboxes.BusyRetryTime,
Mailboxes.NoAnswerRetryCount, Mailboxes.NoOwnerRetryCount,
Mailboxes.BusyRetryCount, Mailboxes.NotifyDelay,
Mailboxes.ConfirmTime, Mailboxes.ProficiencyLevel, Mailboxes.Gender,
Mailboxes.AlarmTriggerCount, Mailboxes.EMAILAddress,
Mailboxes.MiddleName, Mailboxes.OutOfOfficeFileID,
MailboxUserLoginXref.UserLogin,
MailboxStatusXref.BoxStatusNumber,
MailboxUserLoginXref.[Key], MailboxUserLoginXref.BoxNumber
HAVING (MailboxUserLoginXref.UserLogin = ?)
--------End Query-----
Any help will be appreciated.
an error when trying the same query in .Net AccessDataSource Query Builder.
I get the error when I place open parenthesis at the start of the sub query
(Select statement and then the close parenthesis at the end of the sub query
GROUP BY [Account]).
The error I receive is:
Error in SELECT clause: expression near 'SELECT'.
Error in SELECT clause: expression near 'FROM'.
Missing FROM clause.
Unable to parse query text.
The query is as follows:
--------Start Query-----
SELECT Mailboxes.[Key], Mailboxes.BoxNumber, Mailboxes.LastName,
Mailboxes.PhoneNumber, Mailboxes.DirectoryListing, Mailboxes.[Password],
Mailboxes.FirstName, Mailboxes.BoxStatus,
MailboxStatusXref.BoxStatusDescription, Mailboxes.Flags,
Mailboxes.MaxNewMessages,
Mailboxes.MaxSavedMessages,
Mailboxes.MaxMessageLength, Mailboxes.MaxMessageAge,
Mailboxes.GreetingFileID, Mailboxes.NameFileID,
Mailboxes.NotificationID, Mailboxes.NewMessageCount,
Mailboxes.SavedMessageCount, Mailboxes.NoAnswerRetryTime,
Mailboxes.NoOwnerRetryTime, Mailboxes.BusyRetryTime,
Mailboxes.NoAnswerRetryCount, Mailboxes.NoOwnerRetryCount,
Mailboxes.BusyRetryCount, Mailboxes.NotifyDelay,
Mailboxes.ConfirmTime, Mailboxes.ProficiencyLevel, Mailboxes.Gender,
Mailboxes.AlarmTriggerCount, Mailboxes.EMAILAddress,
Mailboxes.MiddleName, Mailboxes.OutOfOfficeFileID,
MailboxUserLoginXref.UserLogin,
MailboxStatusXref.BoxStatusNumber,
MailboxUserLoginXref.[Key] AS Expr1, MailboxUserLoginXref.BoxNumber AS Expr2,
(SELECT COUNT([Status])
FROM Message
WHERE ([Mailboxes.BoxNumber] =
[Message.Account] AND [Status] = N)
GROUP BY [Account]) AS ExprN
(SELECT COUNT([Status])
FROM Message
WHERE ([Mailboxes.BoxNumber] =
[Message.Account] AND [Status] = S)
GROUP BY [Account]) AS ExprS
FROM (((Mailboxes INNER JOIN
MailboxUserLoginXref ON Mailboxes.BoxNumber =
MailboxUserLoginXref.BoxNumber) INNER JOIN
MailboxStatusXref ON Mailboxes.BoxStatus =
MailboxStatusXref.BoxStatusNumber) LEFT OUTER JOIN
Message ON Mailboxes.BoxNumber = Message.Account)
GROUP BY Mailboxes.[Key], Mailboxes.BoxNumber, Mailboxes.LastName,
Mailboxes.PhoneNumber, Mailboxes.DirectoryListing, Mailboxes.[Password],
Mailboxes.FirstName, Mailboxes.BoxStatus,
MailboxStatusXref.BoxStatusDescription, Mailboxes.Flags,
Mailboxes.MaxNewMessages,
Mailboxes.MaxSavedMessages,
Mailboxes.MaxMessageLength, Mailboxes.MaxMessageAge,
Mailboxes.GreetingFileID, Mailboxes.NameFileID,
Mailboxes.NotificationID, Mailboxes.NewMessageCount,
Mailboxes.SavedMessageCount, Mailboxes.NoAnswerRetryTime,
Mailboxes.NoOwnerRetryTime, Mailboxes.BusyRetryTime,
Mailboxes.NoAnswerRetryCount, Mailboxes.NoOwnerRetryCount,
Mailboxes.BusyRetryCount, Mailboxes.NotifyDelay,
Mailboxes.ConfirmTime, Mailboxes.ProficiencyLevel, Mailboxes.Gender,
Mailboxes.AlarmTriggerCount, Mailboxes.EMAILAddress,
Mailboxes.MiddleName, Mailboxes.OutOfOfficeFileID,
MailboxUserLoginXref.UserLogin,
MailboxStatusXref.BoxStatusNumber,
MailboxUserLoginXref.[Key], MailboxUserLoginXref.BoxNumber
HAVING (MailboxUserLoginXref.UserLogin = ?)
--------End Query-----
Any help will be appreciated.