Hello I need a help to build a query that selects from two tables. It seems like I do not get expected results when I use JOIN..
I have to tables:
Table:
booksid int
title varchar
description text
And table
tags book_id int
tag varchar
I need to build a query that will performs a SELECT using a KEYWORD and selects a distinct books.tilte where books.title like %keyword% AND tags.tag like %keyword%. Two tables need to be searched but the result should be DISTINCT books.title, books.id, books.description.
When I run a query using JOIN I get results from both of the tables and I results are duplicating...
Or when I run a query like this
select distinct q.title, q.id from `books` q, tags t where (q.title like "%keyword%") or ( t.tag like "%keyword%")
and there are no results that match q.title I STILL GET rows from table books selected.

Thank you very much for your advice!