Lengkap

Write POSTGRESS select statement, count and unique

I have a table that looks this:

ID | Record | Name | Category

1 12345 Juan Inf General

2 67897 Bill Sports

3 18787 Sandip Inf General

4 38799 Sandip Inf General

5 45791 Sandip Inf General

6 70787 Francis Inf General

7 90447 Allan Sports

8 11100 Aswan Gaming

I need a postgres (9.3) select statement that would return the "count" data like this:

Category | count

----------+-------

Inf General | 2

Sports | 2

Gaming | 1

Note above that the counter should only increment when the value for Name is unique...

One statement that gives the counts but gives the wrong data is this:

statement SELECT category, COUNT(*) FROM "table" GROUP BY category

this gives data like this:

Category | count

----------+-------

Inf General | 5

Sports | 2

Gaming | 1

Kemahiran: PostgreSQL

Lihat lagi: the select group, select, sandip, francis, allan, select category, group write, 11100, postgresql table, need unique name group, name select, sports table, sports write, count data, php mysql select write columns loop, javascript select dropdown adds value field automaticly, javascript select onchange input value, write table postgres, select onchange text value, making select fields retain value, vba excel increment value, increment value vba, select box retain value, excel increment value column macro, excel vba increment value

Tentang Majikan:
( 5 ulasan ) Scottsdale, United States

ID Projek: #6869537

Dianugerahkan kepada:

VictorDuran

Hi Sir, your problem is in the grouping function and probably you'll need a sub-query, I can solve this for you very quickly. Please, consider my bid and contact me if you have any question... PD: it sould be 3 of 'inf Lagi

$15 USD dalam 0 hari
(1 Ulasan)
0.4

5 pekerja bebas membida secara purata $18 untuk pekerjaan ini

joseluiselp

Hi im doing nothing right now, i can help you with this. Let me know if you are interested. Regards jose luis mendoza, programer and designer.

$20 USD dalam 0 hari
(4 Ulasan)
3.3
AndrwProjects

Hi ePrensaSL. I think that select is possible.

$20 USD dalam 3 hari
(2 Ulasan)
2.8
acuenca

Hello, I'm a developer from Venezuela with expertise in SQL. This is a very simple job and I can get it done for you. Regards

$20 USD dalam 0 hari
(0 Ulasan)
0.0
gis7891

Good morning Sir, I have already solved a similar problem in the past so I know to fix it. I have great familiarity with PostgreSQL, I use it. Have a nice evening. Andrea Gagna

$17 USD dalam sehari
(0 Ulasan)
0.0