select last sourcestampsets row that matches conditions

make mysql compliant