Tag Info

New answers tagged

3

You could do it using UDV: #MIN sync_time of user SET @StartDate=(SELECT MIN(sync_time) FROM test._sync_history WHERE object_name='user' LIMIT 0,1); #MAX sync_time of user SET @EndDate=(SELECT MAX(sync_time) FROM test._sync_history WHERE object_name='user' LIMIT 0,1); #Query: SELECT * FROM test.user WHERE lastmodifieddate BETWEEN @StartDate AND @EndDate; ...


-1

From what I gather I would do: SELECT * FROM user WHERE lastmodifieddate IN ( SELECT min(sync_time), max(sync_time) FROM _sync_history WHERE object_name= "user" );


4

You need to find both times, one using what you have (LIMIT 1) and the second using LIMIT 1 OFFSET 1. I'd also use ORDER BY ... DESC, not ASC. Your wording suggests you want the rows between the last 2 appearnces of 'user': SELECT * FROM user WHERE lastmodifieddate > (SELECT sync_time FROM _sync_history WHERE object_name = ...



Top 50 recent answers are included