sql

From: "Shyju Narayanan" <shyjukoyyam(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: sql
Date: 2007-02-02 07:39:09
Message-ID: fecb4bb00702012339t135143d8v42e5cd6c834fca09@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi All

this is my table ;
| ID |entry_user_id_int | category_id_chv |
----------------------------------------------
| 1 | 78 | CV |
----------------------------------------------
| 2 | 78 | VC |
----------------------------------------------
| 3 | 78 | CV |
----------------------------------------------
| 4 | 78 | CV |
----------------------------------------------
| 5 | 78 | CV |
----------------------------------------------
| 6 | 78 | CV |
----------------------------------------------
| 7 | 78 | CV |
----------------------------------------------
| 8 | 78 | CV |
----------------------------------------------
| 9 | 78 | VE |
----------------------------------------------
| 10 | 78 | CV |
----------------------------------------------
| 11 | 78 | SC |
----------------------------------------------

WHEN "select entry_user_id_int, category_id_chv,count(category_id_chv) from
vigilance_master group by category_id_chv,entry_user_id_int having"
entry_user_id_int=78
result is :

ID entry_user_id_int category_id_chv count

1 78 VC 1
2 78 VE 1
3 78 CV 8
4 78 SC 1

BUT I NEED THE RESULT AS
entry_user_id_int COUNT(VC) COUNT(VE) COUNT(CV) COUNT(SC) TOTAL
78 1 1 8 1 11

Responses

  • Re: sql at 2007-02-06 06:41:40 from A. Kretschmer
  • Re: sql at 2007-02-06 07:16:51 from Karthikeyan Sundaram

Browse pgsql-sql by date

  From Date Subject
Next Message Ezequias Rodrigues da Rocha 2007-02-02 13:08:16 Insert into a date field
Previous Message Hiltibidal, Robert 2007-02-01 23:13:03 Re: Index Anding