SELECT 2 tables, proper syntax? |
[eluser]solid9[/eluser]
Before anything else I"m using MyISAM since my hosting don't support InnoDB. I have two tables that has columns, 1st table: users_swap and the columns are Code: usid, 2nd table: swap and the columns are Code: swap_id, I want to SELECT swap_id and offering columns from swap table. Using a specific user_id from users_swap table I hope I explained it clearly. So what is the right SELECT syntax? Thank you very very much in advanced.
[eluser]Otemu[/eluser]
Check out the guide http://ellislab.com/codeigniter/user-gui...ecord.html Here is an example joining two tables $this->db->select('*'); $this->db->from('users_swap'); $this->db->join('swap', 'users_swap.swap_id = swap.swap_id'); $this->db->where('usid', 1); $query = $this->db->get(); This basically joins both tables and selects a usid equal to 1 from the users_swap table |
Welcome Guest, Not a member yet? Register Sign In |