dimanche 24 juillet 2016

Join Postgresql tables on json array columns

I have two tables in postgresql with json array columnstableA.B and tableB.B. How to join these tables on these json columns? i.e.

select tableA.id, tablA.A, tableB.id,tableA.B, tableB.name
from tableA, tableB 
where tableA.B = tableB.B 

--tableA--
id | A     | B                 
1  | 36464 | ["874746", "474657"] 
2  | 36465 | ["874748"] 
3  | 36466 | ["874736", "474654"] 

--tableB--
id | name  | B                 
1  | john  | ["8740246", "2474657"] 
2  | mary  | ["874748","874736"] 
3  | clara | ["874736", "474654"] 

Aucun commentaire:

Enregistrer un commentaire