H
h2fcell
I can tell I had a rough week-end because my brain isn’t working today.
I have the below query with a one to many join.
SELECT public_ipm_bookings.booking_id, public_ipm_booking_items.item_type
FROM public_ipm_bookings INNER JOIN public_ipm_booking_items ON
public_ipm_bookings.oid = public_ipm_booking_items.oid;
Below is a sample of the data returned.
booking_id item_type
C122742 Day Tour
C122742 Flight
C122742 Tour
C122742 Day Tour
C122865 Hotel
C122865 Rail
C122865 Hotel
C122881 Day Tour
C122881 Flight
C122881 Rail
C122881 Hotel
C122894 Free Form
C122945 Day Tour
C122945 Flight
I would like to exclude booking_id record if one of its item_type is Tour.
SELECT public_ipm_bookings.booking_id, public_ipm_booking_items.item_type
FROM public_ipm_bookings INNER JOIN public_ipm_booking_items ON
public_ipm_bookings.oid = public_ipm_booking_items.oid
WHERE (((public_ipm_booking_items.item_type) Not Like "Tour"));
The above SQL only gets rid of the one record C122742, Tour.
I need to drop all C122742 records, not just the one with item_type like Tour.
Any help is appreciated.
I have the below query with a one to many join.
SELECT public_ipm_bookings.booking_id, public_ipm_booking_items.item_type
FROM public_ipm_bookings INNER JOIN public_ipm_booking_items ON
public_ipm_bookings.oid = public_ipm_booking_items.oid;
Below is a sample of the data returned.
booking_id item_type
C122742 Day Tour
C122742 Flight
C122742 Tour
C122742 Day Tour
C122865 Hotel
C122865 Rail
C122865 Hotel
C122881 Day Tour
C122881 Flight
C122881 Rail
C122881 Hotel
C122894 Free Form
C122945 Day Tour
C122945 Flight
I would like to exclude booking_id record if one of its item_type is Tour.
SELECT public_ipm_bookings.booking_id, public_ipm_booking_items.item_type
FROM public_ipm_bookings INNER JOIN public_ipm_booking_items ON
public_ipm_bookings.oid = public_ipm_booking_items.oid
WHERE (((public_ipm_booking_items.item_type) Not Like "Tour"));
The above SQL only gets rid of the one record C122742, Tour.
I need to drop all C122742 records, not just the one with item_type like Tour.
Any help is appreciated.