Anyone knows a list for discussion SQL questions?

On the off chance that this *is* an appropriate list here goes:
I want to select tickets from two tables that registers support tickets and 
events related to the ticket. No problem.

Tickets go through various stages, REGISTERED, OPEN, CLOSED in events
one ticket can have several entries with one of all three stages on each 
row. And can have a technician assigned (field gives username) or be not 
yet assigned to someone (Not Assigned).

Now, I want to select ONLY the ticket that meets Registered *AND* Not 
Assigned. And this should be the final status of the ticket. (All tickets 
may have this status at one time or another).

I've tried:

"SELECT ticket.t_id, t_client, t_summary, e_assignedto, e_status FROM 
ticket, events WHERE e_status = 'REGISTERED' AND e_assignedto = 'Not 
Assigned' AND ticket.t_id = events.t_id";

This gives me ALL hits on this string. Including tickets that have had the 
desired status but is now assigned to someone.

Any suggestions? I'm using MySQL as a database.
Apologies if this is an unappropriate list - and grateful for pointers to 
the correct forum.

M.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to