Welcome Guest, Not a member yet? Register   Sign In
select 2nd maximum problem
#1

[eluser]Bigil Michael[/eluser]
Quote:function select_top2($consti,$elect_year)
{
$result_category = $this->db->query("Select candidate_votes,max(candidate_votes) from candidate_details where candidate_votes < (Select max(candidate_votes) from candidate_details) And elect_year = $elect_year And constituency_id = $consti");
return $result_category->row();
}

I have used this query to find the second maximum value

it works smoothly as localhost

when i upload it to the server
it shows an error
like this

Quote: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 candidate_votes,max(candidate_votes) from candidate_details where candidate_votes < (Select max(candidate_votes) from candidate_details) And elect_year = 2005 And constituency_id = 2

i dont know what is the problem
can anyone help me????
urgent
thanks in advance...




Theme © iAndrew 2016 - Forum software by © MyBB