MySQL Forums
Forum List  »  Newbie

Help querying between 2 tables
Posted by: Lozza Bobby
Date: June 11, 2012 07:49AM

Hi all,

I am writing a search function for a project I am working on. I have written SQL that will query a table and return the tickets from there based on priority, status and a search string using like '%searchstring%'.

The problem I have is this only searches for tickets where as I want to search tickets and responses and have the ticket id returned.

So I have 2 tables one for tickets and one for responses.

The ticket table has a id field (ticketid) and I search using the subject field (string).

The responses table has a field ticketid and message (string).

At the moment the search only works using the subject on the tickets table but I would like to extend this so that I can also get ticketid from the responses table if the search string matches the message also.


so to summarise:


responses table ------> return ticketid --------> where match in message field
tickets table ------> return id --------> where match in subject field


I hope this is clear thanks in advance.

Options: ReplyQuote


Subject
Written By
Posted
Help querying between 2 tables
June 11, 2012 07:49AM


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.