- Seme Framework
- version 4.0.3
- Requirements
- Download & Install
- Configuration
- Tutorials
- URI Routing
- Constants
- Global Variables
- Model
- View
- Controller
- cdn_url
- config
- constructor
- getAdditional
- getAdditionalBefore
- getAdditionalAfter
- getAuthor
- getCanonical
- getContentLanguage
- getDescription
- getIcon
- getJsContent
- getJsFooter
- getJsReady
- getKey
- getKeyword
- getLang
- getRobots
- getShortcutIcon
- getThemeElement
- getTitle
- input
- lib
- load
- loadCss
- loadLayout
- putThemeContent
- putJsContent
- putJsFooter
- putJsReady
- render
- resetThemeContent
- session
- setAuthor
- setCanonical
- setContentLanguage
- setDescription
- setIcon
- setKey
- setKeyword
- setLang
- setShortcutIcon
- setTheme
- setTitle
- Library
- CLI (command line interface)
- Core
- Issue
- Deployment
Select AS Method
The select_as
method is part of Query Builder for selecting column data into a table with its aliases.
Basic Usage
Here is the basic usage select_as
method from $db
property on SENE_Model class.
$this->db->select_as(string $col_name, string $alias [, bool $is_esc=0]): $this->db
Parameters
Update method has 2 required parameters and 1 optional parameter.
$col_name
The $col_name
value can be a single column name or can be filled with wildcard "*", or can be filled with MySQL function.
$alias
The $alias
value can be a string that represent the selected column.
$is_esc
The $is_esc
value can be a boolean, if 1 all value are escaped otherwise unescaped.
Example
For the example we assumed want to select a colum in a table with select_as
method.
class Blog_Model extends SENE_Model{
var $tbl = 'blog';
var $tbl_as = 'b';
public function __construct(){
parent::__construct();
}
public function countPublished(){
$this->db->select_as("COUNT(*)","total",0);
$this->db->from($this->tbl,$this->tbl_as);
$this->db->where("is_published",$is_published);
return $this->db->get_first();
}
}