Count function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Hwa
    New Member
    • Oct 2007
    • 1

    Count function

    I am using Oracle. Can anyone show me how to count distinctly for each Genre ID from following DATA?
    GENRE_ID GENRE_DESCRIPTI ON MOVIE_ID
    -------- -------------------- ----------------------
    AC Action 1
    DR Drama 1
    TR Thriller 1
    CO Comedy 2
    RO Romance 2
    CO Comedy 3
    CR Crime 3
    TR Thriller 3
    AN Animation 4
    CO Comedy 4
    FA Family 4
    AC Action 5
    FY Fantasy 5
    TR Thriller 5
    AC Action 6
    AD Adventure 6
    FY Fantasy 6
    HO Horror 7
    MY Mystery 7
    TR Thriller 7
    AD Adventure 8
    AN Animation 8
    CO Comedy 8
    CR Crime 9
    DR Drama 9
    HO Horror 100
    MY Mystery 100
    TR Thriller 100

    What i want is something like this where it counts the numbers of Movie_id for each genre where there is no duplicate date for genre_id or movie_id.
    Genre_ID Genre_Descripti on Number of Movies
    AC Action 2
  • jeenajos
    New Member
    • Oct 2007
    • 71

    #2
    Hi,

    Try this:
    Select Genre_ID,Genre_ Description,sum (movie_id) from table_name group by Genre_ID,Genre_ Description;

    Comment

    • iburyak
      Recognized Expert Top Contributor
      • Nov 2006
      • 1016

      #3
      Please, move this tread to Oracle forum.

      Comment

      Working...