ID?
Table hope output
Id date id
1 5/1 4
2 5/2
3 5/3 when
1 4/1
2 4/2
3 four thirds
4 4/4
1 3/1
2 l
3 3/3
4 3/4
Now query the date can be implemented within 30 days, the output 1/2/3
Query the date in 30 days can be achieved, the output 1/2/3/4
No record within 30 days is not output, the output of 4
CodePudding user response:
Select distinct id from TB aWhere not the exists (select 1 from TB b where Anderson, d=b.i d and b.d ate> Date_add (now (), interval - 30 day))