I have one table in a database with a structure like:
Id | Name | Money -------------------------- 1 | Joe | 34.50 2 | Jane | 12.55 3 | Kate | 55.21 4 | George | 9.54 5 | Hilary | 45.21 6 | Jacob | 32.00 7 | Ginny | 21.00
Now I want to select one specified record (knowing its Id ) and 3 others that are closest to it (sorting by Money ).
So this is something like:
SELECT * FROM test ORDER BY money LIMIT 4;
Just with the closest (from Money ) to the selected results in a row.
source share