I have polygon(properties) in postgis table and have a info of excel which need to join on posting table property. But it's not simple join it based on two column with matching individual column with separated value by ","
.
I want match if any of comma seperated match the value in respective column. In above case all should be matched.
So far I tried this script but not work good.
SELECT tbl1.gid, id,tbl1.matchid1,cast(tbl2."matchid1" AS varchar) , tbl1.matchid2,cast(tbl2.matchid2 AS varchar), tbl1.geom
FROM public.tbl1 tbl1 left join tbl2 on (cast(tbl1.matchid1 AS varchar) ~~ cast(tbl2.matchid1 AS varchar)) or
(cast(tbl1.matchid2 AS varchar) ~~ cast(tbl2.matchid2 AS varchar))