CodeIgniter Forums
I need help for Many to Many relation database. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: I need help for Many to Many relation database. (/showthread.php?tid=1436)



I need help for Many to Many relation database. - Vimal - 03-10-2015

Hi all,
I am Using CI with hmvc..

I have 3 table

No. 1 as

Table1
  • s_id
  • s_name
  • s_date


Table2
  • n_id
  • n_name
  • n_date

Table3 Contain relation
  • s_id
  • n_id

I want to Fetch values in table1 or table2 by ids.
Like i have n_id of table2 i want to compare values in table3 and want to fetch from table1.

Please help.


RE: I need help for Many to Many relation database. - bastinhas - 03-10-2015

(03-10-2015, 07:28 AM)Vimal Wrote: Hi all,
I am Using CI with hmvc..

I have 3 table

No. 1 as

Table1
  • s_id
  • s_name
  • s_date


Table2
  • n_id
  • n_name
  • n_date

Table3 Contain relation
  • s_id
  • n_id

I want to Fetch values in table1 or table2 by ids.
Like i have n_id of table2 i want to compare values in table3 and want to fetch from table1.

Please help.
You could select all rows of table3 with the n_id you have, and join them with the values of table1 by s_id


You have diferent kinds of join (left join, inner join, outer join...). Is that what you want?