MYSQL ::从表中选择没有最新行的行

时间:2016-03-31 21:04:58

标签: mysql sql database

我正在努力从我的桌子中选择尚未被当前年份修改的行。以下是我放弃的查询示例:

SELECT *  FROM test_cars INNER JOIN
 (SELECT car as c, type as t FROM test_cars 
WHERE YEAR(modified_on)='2016' GROUP BY c,t) as tbl 
ON tbl.c!=car AND tbl.t!=type 
WHERE value !='' 
GROUP BY car,type

1 个答案:

答案 0 :(得分:1)

SELECT car, type 
FROM test_cars
GROUP BY car, type
HAVING sum(YEAR(modified_on) = 2016) = 0