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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:38:12+00:00 2026-05-14T01:38:12+00:00

I have 2 tables. Table_1 has product 3 rows : ID, Quantity and Price.

  • 0

I have 2 tables.

Table_1 has product 3 rows : ID, Quantity and Price.
Table_2 has 2 rows : ID, Special_note.

Not all products have a special note. When a product doesn’t have a special note, there is no row for that product in table 2.

I’m trying to use a select query that will get all the information from table_1 but also grab the special note from table_2 when there’s one.

The problem I’m having right now is that if there is no special note, it won’t grab the information in table_1 at all.

I understand why it’s doing it but I don’t know how to fix the query so that it returns all the products whether there is a special note or not.

 SELECT TABLE_1.ID, QUANTITY, PRICE, SPECIAL_NOTE
 FROM TABLE_1, TABLE_2
 WHERE TABLE_1.ID = TABLE_2.ID

I simplified the query a little bit for the purpose of this example.

Thanks for your help!

  • 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-14T01:38:12+00:00Added an answer on May 14, 2026 at 1:38 am

    Use a LEFT OUTER JOIN:

    SELECT t1.ID, t1.QUANTITY, t1.PRICE, t2.SPECIAL_NOTE
    FROM TABLE_1 t1
    LEFT OUTER JOIN TABLE_2 t2 ON t1.ID = t2.ID
    

    Update:

    To add a WHERE clause, e.g., where quantity >= 1, do this:

    SELECT t1.ID, t1.QUANTITY, t1.PRICE, t2.SPECIAL_NOTE
    FROM TABLE_1 t1
    LEFT OUTER JOIN TABLE_2 t2 ON t1.ID = t2.ID
    WHERE t1.QUANTITY >= 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables: **Product** ID Name SKU **Brand** ID Name Product table has
I have 2 tables. Table 1 has Product ID and Product Name (each row
I have a table that stores product price information. It has a column for
I have two tables. products and productgroups. I use SELECT * FROM `product` `t`
I have 2 tables, 1 with countries, 1 with states. The states table has
I have two tables (TABLE1, TABLE2 - unique i know) that has a 1-to-many
I have several tables 1 contacts and multiple data. Contacts has an ID field
I have two tables; table1, table2, however table1 only has 1 record and table2
I have two tables - table1 and table2 table1 has 14 columns and table2
Performance consideration: Spread rows in multiple tables vs concentrate all rows in one table.

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.