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 9193557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:11:40+00:00 2026-06-17T21:11:40+00:00

My SQL query below says that it is not ended properly on the first

  • 0

My SQL query below says that it is not ended properly on the first Inner Join?If i remove the second table and the where clause the query is fine though?

SELECT homes.home_id, homes.title, homes.description, homes.living_room_count, homes.bedroom_count, homes.bathroom_count, homes.price, homes.sqft,
listagg(features.feature_name, '\n') WITHIN GROUP(ORDER BY features.feature_name) features, home_type.type_name
FROM homes, bookings
WHERE bookings.booking_end < date '2013-01-23' OR bookings.booking_start > date '2013-01-22' AND bookings.home_id <> homes.home_id
INNER JOIN home_feature ON homes.home_id = home_feature.home_id 
INNER JOIN home_type ON home_type.type_code = homes.type_code 
INNER JOIN features ON home_feature.feature_id = features.feature_id 
GROUP BY homes.home_id, homes.title, homes.description, homes.living_room_count, homes.bedroom_count, homes.bathroom_count, homes.price, homes.sqft, home_type.type_name

Can anybody see any obvious errors with my query?

  • 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-06-17T21:11:41+00:00Added an answer on June 17, 2026 at 9:11 pm

    Your WHERE clause is in the wrong place and you are mixing join types:

    SELECT homes.home_id, 
        homes.title, homes.description, 
        homes.living_room_count, 
        homes.bedroom_count, 
        homes.bathroom_count, 
        homes.price, 
        homes.sqft,
        listagg(features.feature_name, '\n') WITHIN GROUP(ORDER BY features.feature_name) features, 
        home_type.type_name
    FROM homes
    INNER JOIN bookings
        ON bookings.home_id = homes.home_id
    INNER JOIN home_feature 
        ON homes.home_id = home_feature.home_id 
    INNER JOIN home_type 
        ON home_type.type_code = homes.type_code 
    INNER JOIN features 
        ON home_feature.feature_id = features.feature_id 
    WHERE bookings.booking_end < date '2013-01-23' 
        OR booking_start > date '2013-01-22' 
    GROUP BY homes.home_id, homes.title, homes.description, 
           homes.living_room_count, homes.bedroom_count, 
           homes.bathroom_count, homes.price, homes.sqft, home_type.type_name
    

    The WHERE clause appears after the JOIN and before GROUP BY. Also you should use one type of of join syntax. You were using both explicit and implicit syntax. I moved the join of homes and booking to a JOIN instead of using a comma between the tables.

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

Sidebar

Related Questions

I have sql query like shown below the sql server says that their is
I have an SQL query (below) that essentially takes a student from tbStudents, and
I have a T-SQL query as below which queries a table holding the search
Below is my PrepareStatement code. It does not generate correct SQL-query. Also it does
I've got the SQL query below: SELECT message, sent_date, user_id FROM messages LEFT JOIN
The following sql query below produced this result cust table CUST_ID AC_NO NAME AREA
I've pasted a very simplified version of my SQL query below. The problem that
Consider the SQL query below: SELECT DISTINCT shops.*, DA.delivery_cost, DA.postcode FROM shops JOIN shops_delivery_area
See the SQL query below, it count the total records that match with numbers
This might be a very simple thing. Check out the normal sql query below

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.