Hi,
We have a problem where we get a SQL error when trying to advance in a Lead search. We get a "SQL error:Incorrect syntax near the keyword 'select'. I looked in the logs and found the bad query:
SELECT TOP 21 * FROM
(
SELECT ROW_NUMBER()
OVER (ORDER BY select name) AS row_number,
leads.id ,leads_cstm.closedclassification_c,leads_cstm.comp etitor_c,leads_cstm.consultant_c,leads_cstm.friend _c,leads_cstm.industrysegment_c,leads_cstm.middlen ame_c,leads_cstm.msa_c,leads_cstm.partner_c,leads_ cstm.priority_c,leads_cstm.suffix_c,leads_cstm.web site_c, ISNULL(leads.first_name,'') + ' ' + ISNULL(leads.last_name,'') as name, leads.first_name , leads.last_name , leads.salutation , leads.status , leads.account_name , leads.account_id , jt0.user_name assigned_user_name , jt0.created_by assigned_user_name_owner , 'Users' assigned_user_name_mod, leads.date_entered , leads.assigned_user_id
FROM leads
INNER JOIN team_memberships team_memberships ON leads.team_id = team_memberships.team_id
AND team_memberships.user_id = '3b778c8d-00df-5082-4ced-4ab79da3fb40'
AND team_memberships.deleted=0
LEFT JOIN leads_cstm ON leads.id = leads_cstm.id_c
LEFT JOIN users jt0 ON
jt0.id= leads.assigned_user_id AND jt0.deleted=0
AND jt0.deleted=0 where leads.deleted=0
) AS a
WHERE row_number > 20
I played around with the query and the culprit seems to be the (ORDER BY select name). Why is there a "select" keyword here. How can I solve this?


LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks