CodeIgniter Forums
How to write mysql select query ( different from normal selection ) - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How to write mysql select query ( different from normal selection ) (/showthread.php?tid=33619)



How to write mysql select query ( different from normal selection ) - El Forum - 09-02-2010

[eluser]suba[/eluser]
Hi all,

How to use CONCAT_WS(), DATE_FORMAT() function in select statement.

My sample 1.
------------
Code:
$this->db->select("DATE_FORMAT('field,'%d-%b-%Y')");
$this->db->get("tablename");
My sample 2.
------------
Code:
$this->db->select("CONCAT_WS('','field1','field2') as name ");
$this->db->get("tablename");

I wrote like this. but I have got error message.
How to write mysql function in select statement?


How to write mysql select query ( different from normal selection ) - El Forum - 09-02-2010

[eluser]bretticus[/eluser]
Code:
$this->db->select("CONCAT_WS('','field1','field2') as name ", FALSE);



How to write mysql select query ( different from normal selection ) - El Forum - 09-02-2010

[eluser]suba[/eluser]
Thanks..