Relatively new to using PHP to access a database I came up with:
$query = "SELECT lab_id, SUM(analyst_samples) FROM labs GROUP BY lab_id";
$result = mysql_query($query) or die(mysql_error());
// Print out result
while($row = mysql_fetch_array($result)){
echo " ". $row['lab_id']. " = $". $row['SUM(analyst_samples)'];
echo "<br />";
The statement is meant to sum the samples processed by an analyst (analyst_samples), and group the results by the lab an analyst works in (lab_id). It does this. The question is, if there is a way to only show certain labs how do I do that? Lets say we have a total of 10 labs listed in the (labs) database. I only want to display four labs (lab_id 1,3,5,8) and omit the other data. Is there a way to do this? Any help would be greatly appreciated even if it is just a link to an answer to a similar question or a tutorial somewhere.
Thank you for your time.