G
Guest
Hi
I need help writing a query. Im trying to use the access wizards but i cannot get it to work
This is what i need to do
I want to retrieve all the details of the last inserted booking from my database. I can do this by selecting the Max(BookingNo). I dont know if there is a better way
Here is the tables im using and the query i have trie
Booking Table Caravan Booking Table Equipment Booking tabl
BookingNo (PK) BookingNo (PK) BookingNo (PK
InvoiceNo, Caravan_Inv_No (PK) Caravan_Inv_No (PK
Dt_Of_Arrival, Equip_Inv_No (PK
Length_Of_Sta
SELECT MAX(dbo.Booking.BookingNo) AS MaxBookingNo,
dbo.Booking.InvoiceNo,
dbo.Booking.Dt_Of_Arrival,
dbo.Booking.Length_Of_Stay,
dbo.Caravan_Booking.Caravan_Inv_No,
dbo.Equipment_Booking.Equip_Inv_No
FROM dbo.Booking INNER JOI
dbo.Caravan_Booking ON dbo.Booking.BookingNo = dbo.Caravan_Booking.BookingNo
LEFT OUTER JOI
dbo.Equipment_Booking ON dbo.Caravan_Booking.BookingNo =
dbo.Equipment_Booking.BookingNo AND
dbo.Caravan_Booking.Caravan_Inv_No = dbo.Equipment_Booking.Caravan_Inv_N
GROUP BY dbo.Booking.BookingNo, dbo.Booking.InvoiceNo,
dbo.Booking.Dt_Of_Arrival, dbo.Booking.Length_Of_Stay,
dbo.Caravan_Booking.Caravan_Inv_No, dbo.Equipment_Booking.Equip_Inv_N
HAVING (dbo.Booking.BookingNo = MaxBookingNo
Can someone plz help me??
I need help writing a query. Im trying to use the access wizards but i cannot get it to work
This is what i need to do
I want to retrieve all the details of the last inserted booking from my database. I can do this by selecting the Max(BookingNo). I dont know if there is a better way
Here is the tables im using and the query i have trie
Booking Table Caravan Booking Table Equipment Booking tabl
BookingNo (PK) BookingNo (PK) BookingNo (PK
InvoiceNo, Caravan_Inv_No (PK) Caravan_Inv_No (PK
Dt_Of_Arrival, Equip_Inv_No (PK
Length_Of_Sta
SELECT MAX(dbo.Booking.BookingNo) AS MaxBookingNo,
dbo.Booking.InvoiceNo,
dbo.Booking.Dt_Of_Arrival,
dbo.Booking.Length_Of_Stay,
dbo.Caravan_Booking.Caravan_Inv_No,
dbo.Equipment_Booking.Equip_Inv_No
FROM dbo.Booking INNER JOI
dbo.Caravan_Booking ON dbo.Booking.BookingNo = dbo.Caravan_Booking.BookingNo
LEFT OUTER JOI
dbo.Equipment_Booking ON dbo.Caravan_Booking.BookingNo =
dbo.Equipment_Booking.BookingNo AND
dbo.Caravan_Booking.Caravan_Inv_No = dbo.Equipment_Booking.Caravan_Inv_N
GROUP BY dbo.Booking.BookingNo, dbo.Booking.InvoiceNo,
dbo.Booking.Dt_Of_Arrival, dbo.Booking.Length_Of_Stay,
dbo.Caravan_Booking.Caravan_Inv_No, dbo.Equipment_Booking.Equip_Inv_N
HAVING (dbo.Booking.BookingNo = MaxBookingNo
Can someone plz help me??