how do i write a join query between the derived table and the orders table to return the Orders withe the maximum order date for each customer
how do i write a join query between the derived table and the orders table to return the Orders withe the maximum order date for each customer
create table Orders(
OrderID int primary key,
CustomerName varchar (200),
OrderDate varchar (200),
ShipDate varchar (200),
);
insert into Orders(OrderID,CustomerName,OrderDate,ShipDate)
values(112,'Cheyenne Wyatt','Apr 5, 2021','Apr 17, 2021')
insert into Orders(OrderID,CustomerName,OrderDate,ShipDate)
values(123,'Zorita Willis','Nov 22, 2021','Nov 27, 2021')
insert into Orders(OrderID,CustomerName,OrderDate,ShipDate)
values(245,'Wang Mcclure','Aug 9, 2021','Aug 16, 2021')
insert into Orders(OrderID,CustomerName,OrderDate,ShipDate)
values(456,'Althea Valdez','Dec 22, 2021','Dec 25, 2021')
insert into Orders(OrderID,CustomerName,OrderDate,ShipDate)
values(789,'Quentin Larsen','May 7, 2022','May 12, 2022')
Step by step
Solved in 2 steps