سؤال

Suppose these are the columns:

 **name**     **course**
   andy          bio         
   brian         math
   andy          chem

How can I count the name "andy" appeared twice?

هل كانت مفيدة؟

المحلول

You could use group by and count by name

Something like:

SELECT name, COUNT(*) FROM my_table GROUP BY name

Here's a SQLFiddle to demonstrate: http://sqlfiddle.com/#!2/966da/1

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top