Sunday, July 22, 2012

finding the previous record with the highest id

this is the SQL query for finding the previous record with the highest id.
SELECT model1.current_period_reading FROM utility_billing model1 WHERE model1.utility_bill_number=(select MAX(model.utility_bill_number) from utility_billing model where model.meter_number = 1)