Sql tables | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

Sql tables

Hi, I am having a problem with 2 tables I have joined. I am trying to get the data not included in one table comparing to another. from the table A i have all the data i am joining to have all the data extracted but i know i can place a is null or some other command to get the specific field on table B to get what I am leaving out. is this corect?

8th May 2018, 9:45 PM
Ruben F. Villanueva Viana
Ruben F. Villanueva Viana - avatar
9 Answers
0
Can you please post your code here?
8th May 2018, 11:35 PM
Ulisses Cruz
Ulisses Cruz - avatar
0
Select Distinct A.branch, A.item, A.cost, B.component From cost as A right join component as B on a.item = B.item Where A.branch = " x " and A.cost = 07 and A.component is null; my component table has the set of items i want to look in the cost table where the item might not be. I want to pull from that table what items on the component table does not exist. this is not exact code but resembels it
9th May 2018, 4:51 AM
Ruben F. Villanueva Viana
Ruben F. Villanueva Viana - avatar
0
Make it a left join Because this has a right join you are getting everything from table B and anything in A that matches (or null if none) Left means give everything from A and the matching data from B (or null if no match)
12th May 2018, 9:12 AM
SQrL
SQrL - avatar
0
do I have have to add anything more so i can get only the null values?
12th May 2018, 10:23 PM
Ruben F. Villanueva Viana
Ruben F. Villanueva Viana - avatar
0
Where B.column is null
12th May 2018, 11:23 PM
SQrL
SQrL - avatar
0
Where can I do code for sal program
20th Nov 2020, 12:58 PM
Vivek Vckey
Vivek Vckey - avatar
0
Where can I do SQL code programming
20th Nov 2020, 12:58 PM
Vivek Vckey
Vivek Vckey - avatar
0
Use left join?
9th Mar 2021, 11:02 AM
huangfu jeff
0
SELECT name,year FROM production WHERE name = 'marvel studios' and year between 2010 and 2019
25th Nov 2023, 12:48 PM
Dagmawi Melaku