Карьера в IT
- 1 ответ
- 0 вопросов
2
Вклад в тег
SELECT sensor_instances.*,
row_to_json((SELECT d
FROM (SELECT groups.*) d
)) AS group,
row_to_json((SELECT a
FROM (SELECT addresses.*) a
)) AS currentAddress,
(
SELECT JSON_AGG(src)
FROM (SELECT sensor_parameters.*
FROM sensor_parameters
WHERE sensor_parameters.sensortype = sensor_instances.sensortype
) src
) AS parameters
FROM sensor_instances
LEFT JOIN groups ON groups.id = sensor_instances.groupid
LEFT JOIN addresses ON sensor_instances.addressid = addresses.id
WHERE sensor_instances.id IN (439)