[eluser]Quaotloa[/eluser]
I know how to use active records to create arrays, I mean the function NOT IN or IN - is there a build in function in active records to do that? Compares to querys..
Like
"$query = SELECT groupid FROM user_group WHERE groupid NOT IN(”.
“SELECT groupid FROM user_group WHERE userid = $userID)"
I tried to do what you suggested.. My query look like this now:
"$result = $this->db->query("SELECT SUM(pris), timeregid FROM timereg_utlegg WHERE timeregid IN(".
"SELECT timeregid FROM timereg WHERE brukerid = '$brukerid' AND dato_strtotime_format > '$sist_dato_for_lonning')");
"
I get this error
"
A Database Error Occurred
Error Number: 1140
Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
SELECT SUM(pris), timeregid FROM timereg_utlegg WHERE timeregid IN(SELECT timeregid FROM timereg WHERE brukerid = '22' AND dato_strtotime_format > '1248991200')
"
How can I rewrite the query to be correct for codeigniter? It works in original PHP