I want to update last_test_date only when there are entries in car_log without status 'test' and I really think this code is horrible, is there any way how to write it better?
UPDATE car SET last_test_date =
(SELECT date FROM car_log WHERE car_log.car_id = car.id AND
car_log.status != 'test' ORDER BY date DESC LIMIT 0,1)
WHERE (SELECT COUNT(*) FROM car_log WHERE car_log_id = client.id AND
car_log.status != 'test') > 0;