Write POSTGRESS select statement, count and unique
$10-30 USD
Pagato alla consegna
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
Rif. progetto: #6869537
Info sul progetto
Assegnato a:
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 Altro
5 freelance hanno fatto un'offerta media di $18 per questo lavoro
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.
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
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