1

I have some static data which stored in a JSON file:

outinfo=
[{out_id:123,out_name:'hello'}]

and I have a table:

----tableA----  
| id | label | out_id |  
| 1  |   a   |   123  |
| 2  |   b   |   123  |

I wanna select all info out like

{id:1,label:"a",out_name:"hello"}

It is easy to achieve that by importing the outside JSON data into DB table, and select them out through a simple left join query. But I wanna know how to achieve that if I don't create a table for those static data.

Andriy M
  • 22,983
  • 6
  • 59
  • 103
Kent Wood
  • 111
  • 2
  • No way. And no reasons for NOT import, especially when the data is static. – Akina Apr 19 '19 at 05:15
  • You'll have to write a programme to do stuff like that! – Vérace Apr 19 '19 at 20:23
  • yes,i was always vacillate in these little decitions. more left join always make me think things come more complex. but if i select the origin data out, then enhance them with other json data by outside program, the complex is apparent. so,i keep them in db at last. – Kent Wood Apr 20 '19 at 01:49
  • This may be part of it: https://dba.stackexchange.com/questions/192208/mysql-return-json-from-a-standard-sql-query – Rick James Apr 27 '19 at 04:23

0 Answers0