GET SUM WHERE in between... I'm trying to only get SUM of fields with an WHERE clause with between numbers... PHP Code: $sql1="SELECT SUM(*) as par_out FROM ".$prefix."_turn_data WHERE turnid=$sturn AND hole_no > 0 AND hole_no < 10"; Something is wrong here, but cant figure out what? Any help apreciated...
Post the entire code bit you are using, not just the variable containing the SQL query (so post your mysql_query command and what you are doing with the result afterward).
You query to get data between two values is incorrect, thus the anomaly or problem in getting right result set. You should use BETWEEN - as shown below More Help : Google "MySQL BETWEEN" Cheers
Yes he should, but that won't break a mysql command. I don't see any syntax errors with what he's using, which leads me to believe it's what he's doing with the results once he's run the query.