0

I try to count a data with integer datatype in a table

I used the query below

SELECT sesi_ujian,hari_ujian,COUNT(DISTINCT sesi_ujian) AS jumlah FROM ujian_mhs

It works, but return 1 result like this the result of query above

and in my table, there are 5 different "sesi_ujian" values, such as : data

can you tell me how to display the counting result of "sesi_ujian" ?

1
  • 1
    use group by sesi_ujian. Commented Dec 28, 2016 at 5:08

2 Answers 2

1

your SQL for it, is wrong. try following

SELECT DISTINCT sesi_ujian,hari_ujian,COUNT(id) AS jumlah FROM ujian_mhs group by sesi_ujian
Sign up to request clarification or add additional context in comments.

Comments

0

If you are looking for only distinct values count. Use the below query.

SELECT COUNT(DISTINCT sesi_ujian) FROM ujian_mhs

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.