SELECT * FROM tablename WHERE key = ( SELECT max(key) FROM tablename WHERE key LIKE '$key,%' )