I have to make a search across two tables and display results from 3 tables.
Table: Clients ( tblclients )
Table: Ticket Details ( tbltickets)
Table: Ticket Replies ( tblreplies)
Ok, What I want to do is to search for a string across the tables ( tbltickets and tblreplies ) on the field details and I want to get the output of the result as the the follows
result must contains the following rows
I tried multiple select queries. However, I am not getting the exact result that I wanted
SELECT firstname, lastname, clientid, tbltickets.id as id
from tblclients, tbltickets, tblreplies
WHERE tblclients.id=tbltickets.clientid
AND tbltickets.id=tblreplies.ticketid
AND
(
tbltickets.details like '%SEARCH_STRING%'
OR
tblreplies.details like '%SEARCH_STRING%'
);