How many rows in a table

SELECT COUNT(*) AS Count FROM tblMyTable;

  $Output = 0;
  if (count($Results) > 0)
    $Output = $Result[0]['Count'];
  
  return($Output);

Count and Group Combined

List the number of customers in each country

SELECT COUNT(Id), Country FROM tblMyTable GROUP BY Country

Adding values returned as a the total

Use SUM()

Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.

Comments

Your email address will not be published. Required fields are marked *