Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting from distance for geography coordinates
Message
De
22/11/2011 11:47:42
 
 
À
22/11/2011 11:46:18
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01529492
Message ID:
01529534
Vues:
17
>>Use a subselect?
>>
>> Something like - untested
>>
>>select 	Result.Numero,
>>	Result.Latitude, 
>>	Result.Longitude,
>>	Result.Distance 
>>  from
>>
>>	( SELECT Client.Numero,
>>		 Client.Latitude,
>>		 Client.Longitude, 
>>		3958.75586574*ACOS(
>>		 CASE WHEN SIN(@Latitude3/57.2957795130823)*SIN(Client.Latitude/57.2957795130823)+
>>		 COS(@Latitude4/57.2957795130823)*COS(Client.Latitude/57.2957795130823)*
>>		 COS(Client.Longitude/57.2957795130823-@Longitude3/57.2957795130823)<-1
>>		 THEN -1
>>		WHEN SIN(@Latitude5/57.2957795130823)*SIN(Client.Latitude/57.2957795130823)+
>>		COS(@Latitude6/57.2957795130823)*COS(Client.Latitude/57.2957795130823)*
>>		COS(Client.Longitude/57.2957795130823-@Longitude4/57.2957795130823)>1
>>		THEN 1
>>		ELSE SIN(@Latitude7/57.2957795130823)*SIN(Client.Latitude/57.2957795130823)+
>>		COS(@Latitude8/57.2957795130823)*COS(Client.Latitude/57.2957795130823)*
>>		COS(Client.Longitude/57.2957795130823-@Longitude5/57.2957795130823)
>> 		END) as Distance 
>>	) Result
>>
>>   where (Distance <= 250)
>>
>>
>
>This works, thanks
>
>I added FROM Client after as Distance.


Yes, of course - I copied and pasted a bit and finally forgot 'From Client'
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform