Jump to content

Multiple query on same table


Staggan

Recommended Posts

Hello

 

We have a database table that confirms the installations started and completed for our game... and I am looking to confirm how many installs start but never complete...

 

So, this is my current query...

SELECT description, ip from error_log where description like '%install%' order by ip;
 
 
description can be either install started or install completed and we use the IP to identify a specific user... 
 
 
How do I query that shows the IP's which have a started but no completed in the description ?
 
Any help would be appreciated
 
Thanks
Link to comment
https://forums.phpfreaks.com/topic/290697-multiple-query-on-same-table/
Share on other sites

in that case

SELECT inst.ip
FROM 
    (
    SELECT ip 
        FROM error_log WHERE description = 'install' 
    ) inst
    LEFT JOIN
        (
        SELECT ip 
        FROM error_log WHERE description = 'install completed'
        ) comp
    USING (ip)
WHERE comp.ip IS NULL
ORDER BY ip

edit : Should be "SELECT inst.ip ...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.