It looks as if you need an outer join, I’ll use a left one in my example:
select t1.Product, t1.Quantity, t2.Cost from table1 as t1 left outer join table2 as t2 on t1.Product = t2.Product
You can also leave out the outer keyword:
select t1.Product, t1.Quantity, t2.Cost from table1 as t1 left join table2 as t2 on t1.Product = t2.Product
Related Posts:
- What is the difference between “INNER JOIN” and “OUTER JOIN”?
- What is the difference between “INNER JOIN” and “OUTER JOIN”?
- SQL Inner-join with 3 tables?
- What’s the difference between INNER JOIN, LEFT JOIN, RIGHT JOIN and FULL JOIN? [duplicate]
- How can I do a FULL OUTER JOIN in MySQL?
- SQL update from one Table to another based on a ID match
- “Not unique table/alias” in MySQL
- Difference between JOIN and INNER JOIN
- What is the difference between JOIN and UNION?
- MySQL Multiple Joins in one query?
- SQL join on multiple columns in same tables
- 1052: Column ‘id’ in field list is ambiguous
- 1052: Column ‘id’ in field list is ambiguous
- Join vs. sub-query
- MySQL Error: : ‘Access denied for user ‘root’@’localhost’
- What’s the best way to search for a UPC code in a Database?
- MySQL Error: : ‘Access denied for user ‘root’@’localhost’
- What is the difference between UNION and UNION ALL?
- Selecting COUNT(*) with DISTINCT
- Case in Select Statement
- What is a stored procedure?
- ORA-00904: invalid identifier
- SQL WITH clause example [duplicate]
- What is an index in SQL?
- Inserting multiple rows in a single SQL query? [duplicate]
- Unknown column in ‘field list’ error on MySQL Update query
- Unknown column in ‘field list’ error on MySQL Update query
- The wait operation timed out. ASP
- What is SELF JOIN and when would you use it? [duplicate]
- The wait operation timed out. ASP
- Conversion failed when converting date and/or time from character string while inserting datetime
- Self Join to get employee manager name
- How do I UPDATE from a SELECT in SQL Server?
- SQL error “ORA-01722: invalid number”
- how to fix oracle ORA-01722 invalid number error
- SQL query to select dates between two dates
- MySQL – Operand should contain 1 column(s)
- SQL SELECT WHERE field contains words
- Conversion failed when converting date and/or time from character string while inserting datetime
- When should I use CROSS APPLY over INNER JOIN?
- MySQL “CREATE TABLE IF NOT EXISTS” -> Error 1050
- Insert Data Into Temp Table with Query
- QL Error: ORA-00933: SQL command not properly ended
- MySQL Error: : ‘Access denied for user ‘root’@’localhost’
- SQL query to get the employee name and their manager name from the same table
- MySQL create table if not exists and insert record only if table was created
- error, string or binary data would be truncated when trying to insert
- How to create Temp table with SELECT * INTO tempTable FROM CTE Query
- NOT IN vs NOT EXISTS
- SQL SELECT WHERE field contains words
- Online SQL Query Syntax Checker
- How can I do an UPDATE statement with JOIN in SQL Server?
- Must declare the scalar variable
- ORA-00979 not a group by expression
- T-SQL split string
- ORA-00907: missing right parenthesis
- Join/Where with LINQ and Lambda
- How do I use properly CASE..WHEN in MySQL
- Must declare the scalar variable
- What is “Advanced” SQL?
- Rename column SQL Server 2008
- Why do we need “Relationships” between tables at all?
- INSERT statement conflicted with the FOREIGN KEY constraint – SQL Server
- Using group by on multiple columns
- Efficiently convert rows to columns in sql server
- How to turn IDENTITY_INSERT on and off using SQL Server 2008?sql-server-2008
- How to delete duplicate rows in SQL Server?
- The SQL OVER() clause – when and why is it useful?
- Update multiple columns in SQL
- Nested select statement in SQL Server
- INSERT statement conflicted with the FOREIGN KEY constraint – SQL Server
- Using group by on multiple columns
- SQL SELECT WHERE field contains words
- SQL Query with NOT LIKE IN
- MySQL query String contains
- How do I escape a single quote in SQL Server?
- What’s the difference between VARCHAR and CHAR?
- Cannot delete or update a parent row: a foreign key constraint fails
- Cannot delete or update a parent row: a foreign key constraint fails
- SQL Server IF EXISTS THEN 1 ELSE 2
- Case statement in MySQL
- How to update multiple columns in single update statement in DB2
- pandas: merge (join) two data frames on multiple columns
- Rename a column in MySQL
- T-SQL split string based on delimiter
- How to declare a variable in MySQL?
- How to implement one-to-one, one-to-many and many-to-many relationships while designing tables?
- Finding duplicate values in a SQL table
- ORA-01843 not a valid month- Comparing Dates
- Cannot delete or update a parent row: a foreign key constraint fails
- SQL Query with SUM with Group By
- MySQL Cannot Add Foreign Key Constraint
- How do I restore a dump file from mysqldump?
- Drop a temporary table if it exists
- How do I perform an IF…THEN in an SQL SELECT?
- How do I escape a single quote in SQL Server?
- SQL Error: ORA-00942 table or view does not exist
- ORA-00918: column ambiguously defined in SELECT *
- Teradata: how to convert varchar value (format ‘dd.mm.yyyy’) to date (format ‘yyyy-mm-dd’ )?
- How Stuff and ‘For Xml Path’ work in SQL Server?