AnsweredAssumed Answered

"More Emails..." returns no results due to bad SQL syntax

Question asked by Nathan Marr on Sep 9, 2014
When I click on More Emails... this is created in the log file. Has anyone seen this before?

Tue Sep  9 08:01:43 2014 [13499][e212aacb-ec3c-1cd9-a62c-53e8faa4d9f8][FATAL] Incorrect syntax near the keyword 'on'.: SELECT TOP 6 * FROM
                                         (
                                             SELECT ROW_NUMBER()
                                                 OVER (ORDER BY emails.date_modified DESC) AS row_number,
                                                 count(*) counter, eear.email_id, N'relate' source 
                                                 from emails_email_addr_rel eear inner join email_addr_bean_rel eabr
             on eabr.bean_id = N'ef7af14a-9e61-0d6d-45b2-53d24d8508a3' and eabr.bean_module = N'contacts' and
             eabr.email_address_id = eear.email_address_id and eabr.deleted=0 where eear.deleted=0
) email_ids on emails.id=email_ids.email_id  where emails.deleted = 0 
                                                 group by  eear.email_id
                                         ) AS a
                                         WHERE row_number > 5

Tue Sep  9 08:01:43 2014 [13499][e212aacb-ec3c-1cd9-a62c-53e8faa4d9f8][FATAL]  Query Failed: SELECT TOP 6 * FROM
                                         (
                                             SELECT ROW_NUMBER()
                                                 OVER (ORDER BY emails.date_modified DESC) AS row_number,
                                                 count(*) counter, eear.email_id, N'relate' source 
                                                 from emails_email_addr_rel eear inner join email_addr_bean_rel eabr
             on eabr.bean_id = N'ef7af14a-9e61-0d6d-45b2-53d24d8508a3' and eabr.bean_module = N'contacts' and
             eabr.email_address_id = eear.email_address_id and eabr.deleted=0 where eear.deleted=0
) email_ids on emails.id=email_ids.email_id  where emails.deleted = 0 
                                                 group by  eear.email_id
                                         ) AS a
                                         WHERE row_number > 5: SQL Server error: Incorrect syntax near the keyword 'on'.

Outcomes