MySQL Forums
Forum List  »  Newbie

SQL Logic Question
Posted by: ozzzwald
Date: May 25, 2005 02:00PM

I have a helpdesk application written in PHP (4.3.4) with a MySQL backend (4.1.2). This question deals with doing a keyword search of a help ticket. That in and of itself isn't a problem at all, but when I want to include searching the work history (ticketresolutions table) all I get are those results that have an entry in the ticketresolutions table. In the system, it is common to have a ticket that has yet to have a resolution associated with it that would need to be searched for. Essentially I need to wrap some sort of logic in the query, but I'm unsure of how to go about this. Any ideas would be a great help. Below is the query as it currently stands. Thanks in advance for your help. Cheers.

SELECT DISTINCT tickets.ticketid, tickets.summary, tickets.createdon,
statuses.name AS STATNAME, products.short AS PRODNAME,
priorities.name AS PNAME,modules.name AS MODNAME
FROM tickets, statuses, products, priorities, modules, ticketresolutions
WHERE (tickets.issue LIKE '%keyword%' OR
tickets.summary LIKE '%keyword%' OR
ticketresolutions.resolution LIKE '%keyword%')
AND tickets.status != '2'
AND tickets.status = statuses.id
AND tickets.product = products.id
AND tickets.priority = priorities.id
AND tickets.module = modules.id
AND tickets.ticketid = ticketresolutions.ticketid
ORDER BY tickets.ticketid DESC;

Options: ReplyQuote


Subject
Written By
Posted
SQL Logic Question
May 25, 2005 02:00PM


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.