created this query but all the customers in the table are not showing up, i want all customers to show in the query even with any null values.there are 26 customers in the customer table but only 12 show when i run the query.
SELECT c.CID, CONCAT(c.FirstName, ' ', c.LastName) AS 'Customer Name',
c.Email, o.OrderDate, o.OrderStatus, o.DeliveryDate, a.AppetizerName, o.AppetizerQuantity,
p.PizzaName, p.PizzaSize, o.PizzaQuantity, pa.PastaName, o.PastaQuantity,
s.SandwichName, o.SandwichQuantity, d.DessertName, o.DessertQuantity,
dr.DrinkName, o.DrinksQuantity, o.TotalPrice
FROM
customer AS c
JOIN
orders AS o ON c.CID = o.CID
INNER JOIN
appetizer AS a ON a.AppetizerID = o.AppetizerID
INNER JOIN
pizza AS p ON p.PizzaID = o.PizzaID
INNER JOIN
pasta AS pa ON pa.PastaID = o.PastaID
INNER JOIN
sandwiches AS s ON s.SandwichID = o.SandwichID
INNER JOIN
dessert AS d ON d.DessertID = o.DessertID
INNER JOIN
drinks AS dr ON dr.DrinkID = o.DrinkID
GROUP BY c.FirstName, c.LastName;
Your issue is that you're using inner joins. These drop null values. If you replace each of your inner joins with left joins, your query should return all 26 customers.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.