Serial | Status | Report
--------------------------------------------
100 | Online | 1
100 | Offline | 2
What I would like to do is generate a "yes to no" report, meaning, list all devices that were online on the previous report and are offline on the current report. Obviously the most current report will have the highest number (MAX) and the previous will be MAX()-1. This is what I have so far:
Code: Select all
SELECT *
FROM table where status like 'online' and rid in (SELECT MAX(rid)-1 from table) Any help is greatly appreciated. My boss is expecting this asap ha.