Select multiple rows closest to date with 1 result for item

How from table:

text | timestamp | pk int
id   | collected | uid
===============
x    | 01.11.12  | 1
x    | 02.11.12  | 2  
a    | 01.11.12  | 3  
b    | 01.11.12  | 4  

Get one row for each id where collected is closest to date 03.11.12 (of closest less):

text | timestamp | pk int
id   | collected | uid
===============
x    | 02.11.12  | 2  
a    | 01.11.12  | 3  
b    | 01.11.12  | 4  

Go to Source
Author: ZiiMakc