The count query is very useful in SQL. Below is the syntax:
SELECT COUNT(thefield) AS outputvariable FROM tablename GROUP BY thefield HAVING anyfield = yourvalue
- thefield is what you want to count
- outputvariable is what you want the count to be saved in
- tablename is the name of the table to look into
- anyfield is any field you want to use as a criteria
- yourvalue is the value for your criteria
This may also work the same for MYSQL.
No comments:
Post a Comment