- 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?
8 ответов
+ 3
It worked
Thank you.
+ 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
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
0
Yes that should be left join
0
No possibility to solve this with Right join?
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.
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.
0
THAT WORKED! @ Kanyin Oni and Brian Alexander