SQL: get previous from max value November 29, 2015 / ,

select max(card_no),vehicle_number
FROM WBG.WBG_01_01
where card_no < (Select max(card_no) from WBG.WBG_01_01 group by vehicle_number) group by vehicle_number
Source: stackoverflow