Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
help for query
  • hi i need help for query in DB::select
    my query is
    select
        i.customer_id,
        sum(i.point) as sm,
        c.first,
        c.last,
        (select count(id) from users where moaref_id = i.customer_id) as moaref,
        (sum(i.point)+(select count(id) from users where moaref_id = i.customer_id)) as total
    from
        invoice i
            inner join
        users c ON c.id = i.customer_id
            left outer join
        users m ON m.id = c.moaref_id
    group by i.customer_id
    order by moaref desc

  • HarroHarro
    Accepted Answer
    Afaik the DB class can't handle subqueries in the select. The rest should be no problem.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion