Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
General
How to put As in select
solidad
November 2012
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.
ilNotturno
November 2012
Accepted Answer
Have a look at this:
http://fuelphp.com/docs/classes/database/qb_select.html#/method_select
You can select do something like that:
select('events.id',
array('constructors.name', 'your_value_name'),
'events.name',
'events.description',
'start_at',
'end_at')
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,088
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
260
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
ilNotturno
November 2012