select a.name,a.datetime,a.money,min(ABS(UNIX_TIMESTAMP(b.datetime)-UNIX_TIMESTAMP('your_date'))) from table as a,table as b group by b.name,a.datetime having ABS(UNIX_TIMESTAMP(a.datetime)-UNIX_TIMESTAMP('your_date'))=min(ABS(UNIX_TIMESTAMP(b.datetime)-UNIX_TIMESTAMP('your_date')))
没有DATETIME字段是DATETIME类型吗?
是