DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: how many times

  1. #1
    Join Date
    Apr 2003
    Posts
    14

    how many times

    simple for many of you guys...
    Question :I have a table with 3 columns with datatype number. the data for each column is between 1 - 30.(300K records)

    Required Solution: A) get a result that would provide how many times a specific # in all the columns are there... eg # 5 shows up 4 times in the below "example data".
    B) occurance of a # in specific column eg # 3 -- 2 times, # 2 -- 2 times etc.

    Any help would be greatly appreciated

    Table A
    -------------
    wn1 number(2) NN
    wn2 number (2)NN
    wn3 number (2)NN

    TABLE A DATA
    WN1 WN2 WN3
    --- --- ---
    2 5 5
    4 11 7
    5 12 9
    3 23 15
    5 24 23
    4 23 23
    3 24 11
    2 27 30
    1 27 12
    ... ... ...
    ...
    ...
    Moe M Haroon

  2. #2
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    Code:
    Select
       Sum(Decode(WN1,5,1,0)+
           Decode(WN2,5,1,0)+
           Decode(WN3,5,1,0))
    From
       TableA;
    I'm not clear what you want from the second part.
    David Aldridge,
    "The Oracle Sponge"

    Senior Manager, Business Intelligence Development
    XM Satellite Radio
    Washington, DC

    Oracle ACE

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width