How do I use multiple "WHERE" clause?

Hi there, I’m trying out something like as follows

$query_Recordset1 = sprintf(“SELECT mark WHERE class=A AS mark1, mark WHERE class=B AS mark2, mark WHERE class=C AS mark3
FROM biology WHERE year = ‘%s’”, $colname_Recordset1);
$Recordset1 = mysql_query($query_Recordset1, $arundel) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

?>

Is there not a simpler way of achieving this?

yes

the first step to simplicity is…

… to pull out the mysql query, discard all the php code, and test your query directly in the mysql engine

:slight_smile:

please show us what that does first, before we simplify it further