From e808aac2627c35d50082f814d9778c4bf976011c Mon Sep 17 00:00:00 2001
From: Derek Allard Release Date: not currently releasedVersion 1.6.2
+
+
+
// Produces: SELECT DISTINCT * FROM table
Permits you to write the HAVING portion of your query:
+Permits you to write the HAVING portion of your query. There are 2 possible syntaxe, 1 argument or 2:
$this->db->having('user_id = 45');
-
-// Produces: HAVING user_id = 45
+You can also pass an array of multiple values as well:
-$this->db->having(array('title =' => 'My Title', 'id <' => $id));
-
-// Produces: HAVING title = 'My Title', id < 45
-
-
-
+$this->db->having(array('title =' => 'My Title', 'id <' => $id));
+
+ // Produces: HAVING title = 'My Title', id < 45
If you are using a database that CodeIgniter escapes queries for, you can prevent escaping content by passing an optional third argument, and setting it to FALSE.
+$this->db->having('user_id', 45');
+// Produces: HAVING `user_id` = `45` in some databases such as MySQL
+
+ $this->db->having('user_id', 45', FALSE);
+// Produces: HAVING user_id = 45
Identical to having(), only separates multiple clauses with "OR".