Welcome Guest, Not a member yet? Register   Sign In
Help building a query using ActiveRecord
#1

[eluser]stormbytes[/eluser]
What are the steps to follow to build the following query using ActiveRecord? (Read the manual...)

Code:
SELECT
  Concat(u.user_first_name, ' ', u.user_last_name) AS User,
  a.account_numb AS Account,
  s.state AS State
FROM
  Users AS u
INNER JOIN Accounts AS a
  ON u.user_id = a.user_id
INNER JOIN States AS s
  ON u.state_id = States.state_id

I'm having trouble figuring out how to piece this together using db->select() & db->join()
or is it that ActiveRecord is more suited for simple queries? Should I be doing this using db->query?


Messages In This Thread
Help building a query using ActiveRecord - by El Forum - 10-19-2010, 04:20 PM
Help building a query using ActiveRecord - by El Forum - 10-19-2010, 05:17 PM
Help building a query using ActiveRecord - by El Forum - 10-20-2010, 06:44 PM
Help building a query using ActiveRecord - by El Forum - 10-24-2010, 07:21 AM
Help building a query using ActiveRecord - by El Forum - 10-24-2010, 11:12 AM
Help building a query using ActiveRecord - by El Forum - 10-25-2010, 10:19 AM
Help building a query using ActiveRecord - by El Forum - 10-25-2010, 01:17 PM
Help building a query using ActiveRecord - by El Forum - 10-25-2010, 01:21 PM
Help building a query using ActiveRecord - by El Forum - 10-25-2010, 04:57 PM
Help building a query using ActiveRecord - by El Forum - 10-25-2010, 05:18 PM
Help building a query using ActiveRecord - by El Forum - 10-25-2010, 05:25 PM



Theme © iAndrew 2016 - Forum software by © MyBB