Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7086939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:36:44+00:00 2026-05-28T07:36:44+00:00

This is the SQL error: Error: 1064 – You have an error IN your

  • 0

This is the SQL error:

Error: 1064 - You have an error IN your SQL syntax; CHECK the manual that corresponds TO         your MySQL server version FOR the RIGHT syntax TO USE near ') and (pi.perm_type='forum' and ( pi.perm_2='*' OR pi.perm_2 LIKE '%,4,%' )) and' at line 2

This is the SQL query:

SELECT t.tid AS id, t.title, t.last_poster_id AS id2,m.member_group_id, 
m.members_display_name AS statistic,pi.perm_2 FROM topics t  LEFT JOIN members m ON (
m.member_id  = t.last_poster_id )
LEFT JOIN permission_index pi ON ( pi.app='forums' AND pi.perm_type='forum' AND 
pi.perm_type_id=t.forum_id )   WHERE t.forum_id NOT IN() AND (pi.perm_type='forum' AND (
pi.perm_2='*' OR pi.perm_2 LIKE '%,4,%' )) AND t.approved=1 AND (t.moved_to='' OR 
t.moved_to IS NULL ) ORDER BY t.last_post DESC LIMIT 0,11

Now, this query runs fine on my MySQL local installation (XAMPP).

Could it be that different MySQL versions would cause the SQL error in this query? And what is causing the error exactly?

  1. The “LIKE” operator?

  2. The nested statement in the where clause? ( Between the () )

  3. Something else?

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:36:45+00:00Added an answer on May 28, 2026 at 7:36 am

    You have an empty NOT IN

    Also, you don’t need one of the WHERE conditions on pi because it is in the LEFT JOIN. However, the LIKE filter in the WHERE on the outer table pi changes this to an inner join.

    So, you’ll need this and fix your IN

    SELECT 
       t.tid AS id, 
       t.title, 
       t.last_poster_id AS id2,m.member_group_id, 
       m.members_display_name AS statistic,  
       pi.perm_2 
    FROM 
       topics t
       LEFT JOIN
       members m ON m.member_id  = t.last_poster_id
       LEFT JOIN 
       permission_index pi ON pi.app='forums' AND pi.perm_type='forum' AND 
                                        pi.perm_type_id=t.forum_id
                                 AND 
                              (pi.perm_2='*' OR pi.perm_2 LIKE '%,4,%')
    WHERE 
       -- t.forum_id NOT IN() -- error is here
       -- AND 
       t.approved=1 
       AND 
       (
        t.moved_to='' OR t.moved_to IS NULL) 
    ORDER BY 
       t.last_post DESC 
    LIMIT 0,11
    

    Much easier when you pay attention to formatting, eh?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get this error:- You have an error in your SQL syntax; check the
Has anyone encountered this error using SQL Server 2005 and Data access application blocks
Why does SQL server express 2008 give me this error? CREATE TABLE model (
I'm trying to import IIS logs into SQL Server 2008. I get this error
Everytime call this stored procedure i get this error: #1064 - You have an
having an issue getting this to work. MySQL keeps throwing the following: ERROR 1064
i am trying this query but didn't work. ERROR: #1064 - You have an
I have taken a dump from my mysql database on my own server (version
mysql> select COUNT(*), * from help_keyword; ERROR 1064 (42000): You have an error in
mysql> ALTER TABLE bdds_arts ADD test VARBINARY; ERROR 1064 (42000): You have an error

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.