Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003
    Posts
    3

    Question Unanswered: Need help please

    Hello people,

    does anyone know how to make a frequency diagram with groups
    in SQL? I have data like

    frequency size
    1 775
    2 780
    1 801

    my query for the data above is:

    SELECT COUNT(*) frequency,size
    FROM EMAIL
    GROUP BY size

    I would have data like

    frequency size
    3 700-800
    1 800-900

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    SELECT COUNT(*) frequency,
    cast(round(size, -2, 1) as varchar(4)) + '-' + cast(round(size, -2, 1) + 100 as varchar(4))
    FROM EMAIL
    GROUP BY round(size, -2, 1)

    More complex buckets would require a more complex formula, or perhaps a link to a table of bucket values.

    blindman

Posting Permissions

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