CodeIgniter Forums

Full Version: I need help for Many to Many relation database.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
(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?