Welcome Guest, Not a member yet? Register   Sign In
Active Record HAVING(MIN())
#1

[eluser]Unknown[/eluser]
I'm trying to use HAVING() with MIN() clause, in my query:
Code:
SELECT * FROM `contact` HAVING MIN(created)
same query giving me correct result (!?)

This same in CI:
Code:
$query = $this->db->having('MIN(created)')->get('contact')->result_array();

giving me:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3

SELECT * FROM `contact` HAVING MIN(created) =


Any help?
#2

[eluser]Unknown[/eluser]
ok...
. / system / databease / DB_query_builder.php
prepare (build) my query then...

in the library:
. / system / databease / DB_diver.php

we have function depends on CI version:
Code:
function _has_operator($str)

ci_211
Code:
$str = trim($str);
if ( ! preg_match("/(\s|<|>|!|=|is null|is not null)/i", $str))

ci_3 dev
Code:
return (bool) preg_match('/(\s|<|>|!|=|IS NULL|IS NOT NULL|BETWEEN)/i', trim($str));

that's why i have "=" on the end of my query

I am a an ass when it comes to regular expression, any help appreciated




Theme © iAndrew 2016 - Forum software by © MyBB