I have something like this.
\d Table1
uid |int (primary key)
name|text
cids|int[]
example:
id | name | cids
1 | joe |{10,20,30}
2 | marry |{10,20,30,40}
3 | john |{30,40}
\d Table2
cid |int (primary key)
name |text
type |int
example
cid | name | type
10 | aname | 0
20 | bname | 0
30 | cname | 1
40 | dname | 0
Now i wanted a result like
id, name from table1 and cid , name from table 2. where type !=1
Example.
id | name | cid |cnames
1 | Joe | {10,20} |{aname,bname}
Please tell me what is the efficient way to do this.
Thanks in advance.
Try this
For Versions < 9.0
(Following Works for version 9+)
SQL DEMO HERE