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
23.3k6 gold badges60 silver badges104 bronze badges
-
No way. And no reasons for NOT import, especially when the data is static.Akina– Akina2019年04月19日 05:15:24 +00:00Commented Apr 19, 2019 at 5:15
-
You'll have to write a programme to do stuff like that!Vérace– Vérace2019年04月19日 20:23:12 +00:00Commented Apr 19, 2019 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– Kent Wood2019年04月20日 01:49:56 +00:00Commented Apr 20, 2019 at 1:49
-
This may be part of it: dba.stackexchange.com/questions/192208/…Rick James– Rick James2019年04月27日 04:23:07 +00:00Commented Apr 27, 2019 at 4:23
lang-sql