Results 1 to 4 of 4

Thread: display issues for computation.

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2003
    Posts
    17

    display issues for computation.

    I have a record set which diplays the results something like this.
    columnA columnB
    9 blah
    1 blahblah
    0 dsjf
    1 blah
    2 blah.

    I am trying to compute this table and populate in my new table as
    newcolumn - A newcolumn - counts newcolumn - percent
    0 1
    1 2
    2 1
    9 1
    Total

  2. #2

    Thread Starter
    Junior Member
    Join Date
    May 2003
    Posts
    17

    I am sorry the post was not complete

    newcolumn - A newcolumn - counts newcolumn - percent
    0 1
    1 2
    2 1
    9 1
    Total will be 5 and the percentile column will be for 0 as 1/5 * 100 like this.
    Help plz..

  3. #3
    Hyperactive Member Anglo Saxon's Avatar
    Join Date
    Mar 2002
    Location
    Durham, UK
    Posts
    259
    I am not sure if I understand exactly what you want try this :
    Code:
    SELECT colA,COUNT(colA) as number,perc=(CAST((COUNT(colA)*100) as float)/(SELECT COUNT(id) FROM tableA))
    FROM tableA
    GROUP BY colA
    This will give you :
    colA,number,perc
    0, 1, 20.0
    1, 2, 40.0
    2, 1, 20.0
    9, 1, 20.0

    Is this what you want?

    --
    Anglo Saxon

  4. #4

    Thread Starter
    Junior Member
    Join Date
    May 2003
    Posts
    17
    I think this should work. Let me try this query - will get back in 10 mins.
    Thanks a lot..

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