Quantcast
Viewing latest article 13
Browse Latest Browse All 25

Group by SQL statement

Hi,
I have a table this.
Name diag1 diag2 diag3  diag4
john     abc     bcd   abc  xyz
david   bcd     abc   xyz  def
john    efh     slx     def    abc

I want to get a count of all abc's, bcd's, xyz, etc for john.
the result set I am expecting is :
john abc(2) bcd(3) xyz(2) etc...
david abc(1) bcd(2)..

Could somebody please provide a sql on how to acheive this..

Viewing latest article 13
Browse Latest Browse All 25

Trending Articles