Results 1 to 2 of 2

Thread: SQL error

  1. #1
    dangeorge6 is offline Member
    Join Date
    Sep 2009
    Posts
    9

    Default SQL error

    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?

  2. #2
    salesagility's Avatar
    salesagility is offline Sugar Community Member
    Join Date
    Aug 2006
    Location
    UK
    Posts
    2,379

    Default Re: SQL error

    BEFORE the error occurred ... had you made any changes, added any new modules/extensions?

    Also ... what versions of Sugar/mysql/php/operating system?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 2009-04-09, 08:46 PM
  2. Replies: 3
    Last Post: 2009-04-07, 09:17 AM
  3. Replies: 3
    Last Post: 2009-02-18, 06:10 PM
  4. Replies: 0
    Last Post: 2008-10-22, 11:24 AM
  5. Replies: 1
    Last Post: 2008-09-18, 11:25 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •