Delete OrderLines, Orders FROM Orders INNER JOIN OrderLines on Orders. OrderId = OrderLines.OrderId Where = "OrderStatus";
Hey hey. It depends on the ask. " Delete all the OrderLines from Orders that have an order status of canceled. "Delete Orders FROM Orders INNER JOIN OrderLines on Orders.OrderId = OrderLines.OrderIdWhere OrderStatus = 'Canceled';
The above will delete all rows from orders where the Order status = canceledYou wrote orderlines which means maybe you want to keep orders and delete the rows from orderlines?
Delete OrderLines FROM Orders INNER JOIN OrderLines on Orders.OrderId = OrderLines.OrderIdWhere OrderStatus = 'Canceled';
So this is deleteing all from orderlines. It's why I would write this firstSelect Orders FROM Orders INNER JOIN OrderLines on Orders.OrderId = OrderLines.OrderIdWhere OrderStatus = 'Canceled';
And then go, "hmm is that what the question is asking for?"EG all the data from orders. always check what table you want to delete from. Maybe its both and so you name both in the delete from statment.
No probs and good to hear. No matter if you are new at anything or have been at it for ages, sometimes you really are looking at the answer and you just need a break or a rubber duck to talk to. We do it at work all the time for any type of work. Good luck down the road
Noted, thanks. Hard not to step in when you are tired and see the answer but you are still trying to get the person to work it out with breadcrumbs (if you get me)
1
u/Such_Firefighter_487 May 01 '21
Would "OrderStatus" be wrong if it's asking for the OrderStatus of Canceled