IZ
Size: a a a
IZ
IZ
G
ВТ
ВТ
G
G
IZ
s
s
SELECT tu.id,
tu.firstname,
tu.lastname,
role,
CONCAT('${constant.profile_image}',profile_image) as profile_image,
CONCAT('${constant.cover_image}',cover_image) as cover_image,
CONCAT('${
constant.profile_image_imagekit
}',profile_image, ?) as profile_image_imagekit,
CONCAT('${
constant.profile_image_imagekit
}',cover_image, ?) as cover_image_imagekit,
((6372 * 2 * ASIN(
SQRT(POWER(SIN((${loginSession.lat} - tu.lat) * pi() / 180 / 2), 2) +
COS(${loginSession.lat} * pi() / 180) * COS(tu.lat * pi() / 180) *
POWER(SIN((${loginSession.lng} - tu.lng) * pi() / 180 / 2), 2))
)) * 1000) AS distance,
IF(
tu.id IN (${friendsList.primaryUsers.join(', ')}),
TRUE,
FALSE
) as is_friends
FROM tbl_user tu
LEFT JOIN tbl_users_groups_relations tug ON tu.id = tug.user_id
LEFT JOIN tbl_groups tg ON tug.group_id = tg.id
WHERE tg.id = ?
AND IF(
tg.type != '${GROUP_TYPES.Gym}',
tu.id IN
(${[...friendsList.primaryUsers, ...friendsList.otherUsers].join(', ')}),
tg.type = '${GROUP_TYPES.Gym}'
)
AND tu.is_delete = '0'
AND tu.deleted_at IS NULL
HAVING (distance between 0 AND 200000)
ORDER BY
FIELD(role, 'A', 'M', 'U'),
profile_image = '${constant.default_image_name}',
tu.firstname,
tu.lastname
LIMIT ?
OFFSET ?
V
DB
DB
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name
(create_definition,...)
[table_options]
[partition_options]
DB
DB
DB