|
Сложный json
|
|||
---|---|---|---|
#18+
В таблице machines есть столбец, в котором jsonb: [ {"full": 359.219774658, "treshold": 5756.19828506, "remainder": 168834.50104302, "component_id": 886}, {"full": 2.3901343, "treshold": 7990331.24, "remainder": 36335.11568421, "component_id": 294} ] Вопрос: какой запрос вернет такие же данные только с добавлением name из таблицы components (можно как text)? [ {"full": 359.219774658, "treshold": 5756.19828506, "remainder": 168834.50104302, "component_id": 886, "name": "component_886_name"}, {"full": 2.3901343, "treshold": 7990331.24, "remainder": 36335.11568421, "component_id": 294, "name": "component_294_name"} ] ... |
|||
:
Нравится:
Не нравится:
|
|||
15.02.2017, 17:16 |
|
Сложный json
|
|||
---|---|---|---|
#18+
Вот так получается взять данные по component_id, но пока как скомпоновать я не осознал. Код: plsql 1. 2. 3. 4.
... |
|||
:
Нравится:
Не нравится:
|
|||
15.02.2017, 17:50 |
|
Сложный json
|
|||
---|---|---|---|
#18+
Вот так получается вывести для одного machine_id, но как сделать слияние Код: plsql 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17.
Получается (а надо чтобы было слияние для одного machine_id): 1;"[{"full": 359.219774658} {"treshold": 5756.19828506} {"remainder": 168834.50104302} {"component_id": 886} {"component_name": "name_quaerat"} {"component_measure": "measure_incidunt"}]"1;"[{"full": 2.3901343} {"treshold": 7990331.24} {"remainder": 36335.11568421} {"component_id": 294} {"component_name": "name_vel"} {"component_measure": "measure_doloremque"}]"1;"[{"full": 8314404.3240166} {"treshold": 0} {"remainder": 36701807.282} {"component_id": 877} {"component_name": "name_eveniet"} {"component_measure": "measure_eius"}]" ... |
|||
:
Нравится:
Не нравится:
|
|||
15.02.2017, 18:23 |
|
Сложный json
|
|||
---|---|---|---|
#18+
Вот так получилось. Код: plsql 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17.
... |
|||
:
Нравится:
Не нравится:
|
|||
16.02.2017, 12:05 |
|
|
start [/forum/topic.php?fid=53&fpage=78&tid=1996704]: |
0ms |
get settings: |
9ms |
get forum list: |
12ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
33ms |
get topic data: |
12ms |
get forum data: |
2ms |
get page messages: |
36ms |
get tp. blocked users: |
2ms |
others: | 327ms |
total: | 441ms |
0 / 0 |