Active Record Class Join question

Hello I am having a little problem getting my head around the active record class. I have need make a simple SQL query. I have three tables tariff, state, and market. state and market have foreign keys inside the tariff table. Here is the SQL Query that works corectly on the data.
SELECT TARIFF.tariff_id, TARIFF.schedule, STATE.state,
WHERE TARIFF.state_id = STATE.state_id && MARKET.market_id = TARIFF.market_id

I get into trouble when I try to add the second and third tables into the mix. Can anyone help me out with the right way to do this. If I could see the example I think I could expand on it for the rest of my application.

Thank you in advance

$this->db->select('TARIFF.tariff_id, TARIFF.schedule, STATE.state,');
$this->db->from('TARIFF,STATE, MARKET');
$this->db->where('TARIFF.state_id = STATE.state_id && MARKET.market_id = TARIFF.market_id');
$result = $this->db->get();

Xwero thank you so much. I thought I tried that I must have had a typo in my code when I tried it and that is why it didn't work. Thank you so much.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.