I have created an sql query command to get data from these three tables , this command must help the user to search for a course from an search input , in this search input he can write the name of the course or the name of the teacher who posted the course orthe key words of the course... through: name of the course(cours table) ,through name of teacher(user table), through key words(motCle table
i have wrote this command , but i have i m getting a wrong result while querying with key words ,
SELECT *
FROM cours c
JOIN users u ON u.id= c.userId
WHERE (c.nom LIKE '%name%' OR u.nom LIKE '%name%') OR EXISTS(
SELECT *
FROM cours c
JOIN intermots i ON i.coursId= c.id
JOIN motcles m ON i.motCleId = m.id
WHERE m.nom LIKE '%name%')

UNION.