query in codeIgniter style
Posted
by
troy
on Pro Webmasters
See other posts from Pro Webmasters
or by troy
Published on 2012-10-25T10:17:04Z
Indexed on
2012/10/25
11:16 UTC
Read the original article
Hit count: 230
codeigniter
I have below query:
SET @sql = NULL ;
SELECT GROUP_CONCAT( DISTINCT CONCAT( 'select latitude,longitude,max(serverTime) as serverTime,', deviceID, ' AS device from d', deviceID, '_gps' )
SEPARATOR ' UNION ALL ' )
INTO @sql
FROM devices
WHERE accountID =2;
PREPARE stmt FROM @sql ;
EXECUTE stmt;
Can someone help me to write the above query in codeIgniter style....
ANd another thing is :What is the difference between writing the query in 1 and 2 formats
1. $query = $this->db->query('YOUR QUERY HERE');
2. $this->db->select("...");
$this->db->from();
$this->db->where();
Will it have any effect on performance if we use 2nd style... Thank You
© Pro Webmasters or respective owner