Re: [PHP-DB] Help to improve MySQL query

2008-08-11 Thread Dee Ayy
On Sat, Aug 9, 2008 at 1:32 AM, Niel Archer <[EMAIL PROTECTED]> wrote: > Hi > > You do not say how you identify the last call (there is no date/time > field for example), so a complete answer is not really possible With the "id (auto incremented int)", the last record of either table would be the

Re: [PHP-DB] Help to improve MySQL query

2008-08-11 Thread Micah Gersten
Use an appropriate status. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Dee Ayy wrote: > On Fri, Aug 8, 2008 at 5:25 PM, Micah Gersten <[EMAIL PROTECTED]> wrote: > >> How about "select Incidents.* from Incidents inner join Calls on >> Incidents.id=Calls

Re: [PHP-DB] Help to improve MySQL query

2008-08-11 Thread Dee Ayy
On Fri, Aug 8, 2008 at 5:25 PM, Micah Gersten <[EMAIL PROTECTED]> wrote: > How about "select Incidents.* from Incidents inner join Calls on > Incidents.id=Calls.incidentid where Calls.status='Open'"? ... > > Dee Ayy wrote: ... >> The status column never has the text "Open". ... -- PHP Database Ma

Re: [PHP-DB] Help to improve MySQL query

2008-08-08 Thread Niel Archer
Hi You do not say how you identify the last call (there is no date/time field for example), so a complete answer is not really possible Do not use "NOT LIKE 'Completed'", it's an inefficient way of doing "!= 'Completed'" -- Niel Archer -- PHP Database Mailing List (http://www.php.net/) To un

Re: [PHP-DB] Help to improve MySQL query

2008-08-08 Thread Micah Gersten
How about "select Incidents.* from Incidents inner join Calls on Incidents.id=Calls.incidentid where Calls.status='Open'"? Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Dee Ayy wrote: > A database was designed with the following tables: > > Incidents >

[PHP-DB] Help to improve MySQL query

2008-08-08 Thread Dee Ayy
A database was designed with the following tables: Incidents _ id (auto incremented int) ... Calls _ id (auto incremented int) incidentId (foreign key) status (varchar 32) ... The status of the last Call is the status of the related Incident. Statuses can be "Not started" through var