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

  • Home
  • SEARCH
  • 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 7399107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:00:53+00:00 2026-05-29T04:00:53+00:00

I have a complex query and it was working fine before adding one more

  • 0

I have a complex query and it was working fine before adding one more line:
the working query:

         $query = "SELECT SQL_CALC_FOUND_ROWS *
                    FROM realestate
                    INNER JOIN users ON id_user = users.id
                    LEFT JOIN pic ON id_realestate = realestate.id
                    group by realestate.id
                    ORDER BY {$order}
                    LIMIT 0 , 10";

the value of $order is date DESC

after adding one more line, here is the query:

         $query = "SELECT SQL_CALC_FOUND_ROWS *
                    FROM realestate
                    {$place} 
                    INNER JOIN users ON id_user = users.id
                    LEFT JOIN pic ON id_realestate = realestate.id
                    group by realestate.id
                    ORDER BY {$order}
                    LIMIT 0 , 10";

$place has this value WHERE address =1 the field name address doesn’t duplicate in other tables.
I get this mysql error :

  Database query failed: 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
 'INNER JOIN users ON id_user = users.id LEFT JOIN pic ON id_realestate = real' 
  at line 4
  • 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-29T04:00:54+00:00Added an answer on May 29, 2026 at 4:00 am

    JOIN clauses must come before WHERE clauses. You have your clauses in the wrong order.

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

Sidebar

Related Questions

I have this mysql query using PHP and first part is working fine, but
I have a fairly complex query in which I am working with with multiple
I'm working on what is turning out to be a fairly complex SELECT query.
I have a complex query with group by and order by clause and I
I have a complex query that gets executed like this: if ($stmt = $dbi->prepare($pt_query))
I have a complex sql query that I have in a stored procedure and
I am using WCF and REST, and I have complex types, which are working
I am trying to do a complex query from two tables...It's a question from
I'm working on a query where I pull data from multiple tables using left
Intro I have a complex query I need to write (for an Oracle DB).

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.