MySQL Forums
Forum List  »  Newbie

A mal-understanding of inner joins
Posted by: John Allsopp
Date: July 07, 2017 02:41PM

Hi

This is supposed to show me this month's events where the event title contains %market%, or either of its category descriptions do

SELECT * FROM event as e
inner join event_category as ec1 on e.event_category_1 = ec1.id
inner join event_category as ec2 on e.event_category_2 = ec2.id
where (e.title LIKE '%market%' || ec1.category_name LIKE '%market%' || ec2.category_name LIKE '%market%')
AND MONTH(date_from) = '7'
AND YEAR(date_from) = '2017'
ORDER BY date_from ASC

It doesn't show me any current matches, it comes up with something from 1995.

What am I missing?

All help appreciated.

Cheers
J

Options: ReplyQuote


Subject
Written By
Posted
A mal-understanding of inner joins
July 07, 2017 02:41PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.