How to find the nearest lat and lang in postgresql
yes i got the output with this query, and thank you to all who tried to help me:)

select * from (SELECT  *,( 3959 * acos( cos( radians(6.414478) ) * cos( radians( lat ) ) * cos( radians( lang ) - radians(12.466646) ) + sin( radians(6.414478) ) * sin( radians( lat ) ) ) ) AS distance FROM table name) al where lat &gt;= 22.566 OR lat &gt;= 59.52 AND lat &lt;= 22.566 OR lat &lt;= 59.52 ORDER BY distance LIMIT 3;