Search
 
SCRIPT & CODE EXAMPLE
 

SQL

php get closest location by latitude longitude

SELECT * , (3956 * 2 * ASIN(SQRT( POWER(SIN(( $lat - LatOnTable) *  pi()/180 / 2), 2) +COS( $lat * pi()/180) * COS(LatOnTable * pi()/180) * POWER(SIN(( $long - LongOnTable) * pi()/180 / 2), 2) ))) as distance  
from yourTable  
having  distance <= 10 
order by distance
Comment

PREVIOUS NEXT
Code Example
Sql :: how to search query in python3 sqlite3 
Sql :: sql view index 
Sql :: mysql concat and use as where column 
Sql :: add primary key to database sql 
Sql :: mysql command prompt date insert format 
Sql :: oracle tablespace usage 
Sql :: postgresql create table many-to-many 
Sql :: sql join on a subquery 
Sql :: delete all duplicate rows keep the latest except for one in mysql 
Sql :: php5-mysql has no installation candidate 
Sql :: delete vs truncate sql server 
Sql :: mysql if statement in where clause 
Sql :: square in sql 
Sql :: mysql mediumtext 
Sql :: replace content value from old to new sql 
Sql :: insert to postgres table 
Sql :: case condition in mongodb 
Sql :: sql if function 
Sql :: primary key sql 
Sql :: get size of mysql database 
Sql :: mysql search multiple tables 
Sql :: oracle ora-00054 how to unlock 
Sql :: azure check access to sql database 
Sql :: select where mysql 
Sql :: logical operators in sql 
Sql :: sql server size of every table in a db 
Sql :: mysql update multiple columns 
Sql :: postgres meta command to show all rows in table 
Sql :: 0 
Sql :: concatenation in sql 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =