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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:14:06+00:00 2026-06-11T12:14:06+00:00

Now ,I have two tables, Location and q_Location , location as main table .I

  • 0

Now ,I have two tables, Location and q_Location, location as main table .I write sql left join like this:

SQL1:
    SELECT L.ID,QL.* 
    FROM LOCATION L 
    LEFT JOIN Q_LOCATION QL ON L.ID=QL.LOCATION_ID 
                         AND L.WAREHOUSE_ID=QL.WAREHOUSE_ID
                         AND ISNULL(ql.VIRTUAL, 'N') = 'N' 
                         AND ISNULL(ql.PICKABLE, 'y') = 'Y' 
    where l.warehouse_id='mmc-main

but the result is wrong. if sql statement like this:

SQL2:  
    SELECT L.ID,QL.* 
    FROM LOCATION L 
    LEFT JOIN Q_LOCATION QL ON L.ID=QL.LOCATION_ID 
                            AND L.WAREHOUSE_ID=QL.WAREHOUSE_ID
    where l.warehouse_id='mmc-main' 
    AND ISNULL(ql.VIRTUAL, 'N') = 'N'
    AND   ISNULL(ql.PICKABLE, 'y') = 'Y' 

now The result if correct. I want to know why the first sql is wrong, somebody can help me ? thanks first!

  • 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-11T12:14:07+00:00Added an answer on June 11, 2026 at 12:14 pm

    Be careful about applying filters in an OUTER JOIN (left or right) – it is NOT the same as applying the filter in the WHERE clause. Your first query doesn’t work as you expect it to, because if the join fails, the LEFT table rows will still be returned, and your additional RIGHT table filters ISNULL(ql.VIRTUAL, 'N') = 'N' and ISNULL(ql.PICKABLE, 'y') = 'Y' will be ignored.

    See also here: WHERE Clause vs ON when using JOIN

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

Sidebar

Related Questions

I have two tables: This is table1: product_id|product_desc|product_name|product_s_desc This is table2: product_price_id|product_id|product_price Now I
I have two tables, locations and location groups CREATE TABLE locations ( location_id INT
I have two tables, one called cart and one called items. Now I want
Hie frnds, I have two tables say Orders and OrdersXML now I wish to
I have two table first is TABLE_SUBJECT and second is TABLE_CHAPTER.Now i want to
I have a city table that has two columns from_city to_city now lets assume
I have a large table (~1M rows now, soon ~10M) that has two ranked
I have two tables, one for values one for location and am trying to
Lets say I have two tables, one for transactions, and another table who's primary
I have self join table. This table is being used to join up to

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.