I would like to count the number of rows from a mysql table and not to include duplicate entries,
Could I use distinct
with count()
?
当然。
SELECT COUNT(DISTINCT column) FROM table;
What you need is the following:
SELECT field_type_name, count(*) FROM fields GROUP BY field_type_name;
This will give you something like this:
image 14
string 75
text 9
SELECT COUNT(DISTINCT field) from Table
看到这个 。
SELECT count(DISTINCT column Name) as alias from table_Name;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.