Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
How to put As in select
  • This is a CRUD find:: closure statement. I just remove put the important code.

    return $q->select('events.id','constructors.name','events.name','events.description','start_at','end_at')
                            ->join('constructors','right outer')->on('events.constructor_id','=','constructors.id')
                            ->where('start_at','between',array(date($format),  date_format($end_date, $format)))
                            ->limit(6)
                            ->order_by('start_at','desc');

    When I query this, I only get events.name value. I would believe this is because I have two names filed and it cancelling the constructor.name. To solve this is to use As like in SQL, but there's no documentation on how place it.
  • ilNotturnoilNotturno
    Accepted Answer
    Have a look at this:

    You can select do something like that:
    select('events.id',
              array('constructors.name', 'your_value_name'),
              'events.name',
              'events.description',
              'start_at',
              'end_at')

Howdy, Stranger!

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

In this Discussion