I am having a few issues with what is probably a reasonably simple SQL statement - unfortunately, my skills don't go as far as this and I can't get my head round it!
I have, for example, the following tables:
- booking_record
- client
Booking record may have many bookings for one client, they are linked via 'labelno'.
I would like to select the clients who have booked last but not booked this . I.e. This client has booked this month last year, but hasnt booked this year.
I only got as far as selecting either situation, for example:
Select client_.title,
client_.initial,
client_.surname,
client_.labelno,
client_.email,
booking_record_.bookingdate
From booking_record booking_record_
Inner Join client client_ On booking_record_.labelno = client_.labelno
Where client_.email Not Like ''
And Date_Format(booking_record_.bookingdate, '%m') = ?Param1
And Date_Format(booking_record_.bookingdate, '%Y') = Year(AddDate(Now(), Interval -1 Year))
Group By client_.labelno
I had a quick look at views, but this is being used within a report designer which doesn't appear to support views (or at least, not at design time). Is it possible to get what I need without the use of views?
Thanks, Daniel.