This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE or REPLACE FUNCTION find_remoteness_btw_cords(lat1 double precision, lng1 double precision, lat2 double precision, lng2 double precision) | |
RETURNS double precision | |
LANGUAGE plpgsql AS $$ | |
BEGIN | |
RETURN ACOS(SIN(PI()*lat1/180.0)*SIN(PI()*lat2/180.0)+COS(PI()*lat1/180.0)*COS(PI()*lat2/180.0)*COS(PI()*lng2/180.0-PI()*lng1/180.0))*6367000; | |
END; | |
$$; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s = str(input()) | |
l = len(s)-1 | |
c = 1 | |
t = '' | |
if len(s) == 1: | |
t = t + s +str(c) | |
else: | |
for i in range(0,l): | |
if s[i] == s[i+1]: | |
c += 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
* | |
FROM profiles_courier | |
LEFT JOIN (SELECT ---- ДЖойним заказы с выручкой/предоплатой за последние 7 дней исключая now() - 1 day | |
courier_id, | |
count(orders.id) cashorders, -- Всего заказов | |
sum(declared_value) cashsum, -- Общая сумма | |
max(declared_value) maxcash -- Максимальная сумма в 1 заказе |
NewerOlder