I have this data in my database :
nama tanggal
ADIESTY.SW 2017-03-01
ADIESTY.SW 2017-03-01
ADIESTY.SW 2017-03-02
ADIESTY.SW 2017-03-02
ADIESTY.SW 2017-03-03
ADIESTY.SW 2017-03-03
ADIESTY.SW 2017-03-05
ADIESTY.SW 2017-03-05
ALFRED APDIAN 2017-03-01
ALFRED APDIAN 2017-03-01
ALFRED APDIAN 2017-03-02
ALFRED APDIAN 2017-03-02
ARI PUTRA 2017-03-01
ARI PUTRA 2017-03-01
ARI PUTRA 2017-03-02
ARI PUTRA 2017-03-02
ARI PUTRA 2017-03-03
ARI PUTRA 2017-03-03
How do I count by distinct date (tanggal)? So the result I want is:
nama tanggal
ADIESTY.SW 4
ALFRED APDIAN 2
ARI PUTRA 3
Use this
select nama,count(distinct tanggal) from your_table
group by nama;
http://rextester.com/ZOZQK78377
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With