- 2

Right Join

You want to see the weekly delivery report. Write a query to output all customers and their orders in one table (fullname - age - address - amount) My code: SELECT customers.fullname, customers.age, customers.address, orders.amount FROM customers RIGHT OUTER JOIN orders ON customers.id = orders.customerid Where am I wrong?

13th May 2021, 2:18 PM
Elizabeth Makinde
8 Answers
+ 3
It worked Thank you.
13th May 2021, 2:39 PM
Elizabeth Makinde
+ 1
You have to switch the order in which you "outer join" like this select customers.fullname, customers.age, customers.address, orders.amount from orders right outer join customers ON orders.customerid = customers.id
22nd Jan 2022, 3:20 AM
Kanyin Oni
0
Elizabeth Makinde Problem says to use RIGHT JOIN but There should be LEFT JOIN. SELECT fullname, age, address, amount from customers c LEFT JOIN orders o ON c.id = o.customerid
13th May 2021, 2:28 PM
A͢J
A͢J - avatar
0
Yes that should be left join
7th Jul 2021, 6:20 AM
Elwyn Ynion
Elwyn Ynion - avatar
0
No possibility to solve this with Right join?
14th Sep 2021, 7:04 AM
Abdul Haseeb Sharif
Abdul Haseeb Sharif - avatar
0
SELECT c.fullname, c.age, c.address, o.amount FROM orders AS o RIGHT OUTER JOIN customers AS c ON c.id = o.customerid Works as a RIGHT JOIN. The above solutions are fine if you swap the order in which you call the table.
8th Dec 2021, 12:48 AM
Brian Alexander Theodore Olsen
Brian Alexander Theodore Olsen - avatar
0
Heya this problem can only be solved by using the LEFT OUTER JOIN methord as you need to call all of the left table infomation, i.e the customer info regardless of where or not they have an order amount.
11th Dec 2021, 7:54 PM
ellis spinks
0
THAT WORKED! @ Kanyin Oni and Brian Alexander
20th Feb 2022, 6:14 AM
Raymond Hansen
Raymond Hansen - avatar