Announcement

Collapse
No announcement yet.

How to create a report showing # of rows with a particular value?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to create a report showing # of rows with a particular value?

    I'm going to try to really simplify my issue here. Basically, I'm looking to create a report (I assume summary grid?) that with several rows, each showing the number of database rows that contain a particular value.

    Support I have the database:
    id, letter, color
    1, a, blue
    2, a, red
    3, a, green
    4, b, blue
    5, b, blue
    6, c, red
    etc

    Now I'd like a report that says:
    Number of As: 3
    Number of Bs: 2
    Number of Cs: 1
    Number of Blues: 3
    Number of Reds: 2
    Number of Greens: 1

    Thanks in advance for your help!

  • #2
    Hmm, try something like this in your query's Select clause :

    SUM(CASE WHEN color = red THEN 1 ELSE 0 END) AS `Number of Reds`,
    SUM(CASE WHEN color = blue THEN 1 ELSE 0 END) AS `Number of Blues`,

    .....and so on

    Comment


    • #3
      Thanks for the reply! I think that I can get something like that to work, but there will be a lot of these lines. How to get them to show in columns rather than rows? (rotate table display?)

      Comment


      • #4
        For that just change the Type option in the Settings area of your PDF report.

        Comment

        Working...
        X