Poor (Wo)Man’s Graph

Lary shared this poor (wo)man’s graph with me today, and I thought it was pretty awesome:

Select OrderDate 
    , COUNT(*) As 'orders'
    , REPLICATE('=', COUNT(*)) As 'orderGraph'
    , SUM(TotalDue) As 'revenue'
    , REPLICATE('$', SUM(TotalDue)/1000) As 'revenueGraph'
From AdventureWorks.Sales.SalesOrderHeader
Where OrderDate Between '2003-07-15' And '2003-07-31'
Group By OrderDate
Order By OrderDate;

This will return a simple but effective “graph” for you:

orderDate  orders orderGraph                     revenue  revenueGraph
---------- ------ ------------------------------ -------- ----------------------------------------
2003-07-15 19     ===================            34025.24 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$      
2003-07-16 14     ==============                 26687.65 $$$$$$$$$$$$$$$$$$$$$$$$$$$             
2003-07-17 16     ================               32411.93 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$        
2003-07-18 9      =========                      18634.91 $$$$$$$$$$$$$$$$$$$                     
2003-07-19 13     =============                  19603.23 $$$$$$$$$$$$$$$$$$$$                    
2003-07-20 24     ========================       47522.80 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
2003-07-21 9      =========                      11781.62 $$$$$$$$$$$$                            
2003-07-22 17     =================              32322.50 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$        
2003-07-23 15     ===============                30906.44 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$         
2003-07-24 28     ============================   51107.90 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
2003-07-25 15     ===============                27058.10 $$$$$$$$$$$$$$$$$$$$$$$$$$$             
2003-07-26 18     ==================             41076.49 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
2003-07-27 15     ===============                22169.88 $$$$$$$$$$$$$$$$$$$$$$                  
2003-07-28 16     ================               23945.80 $$$$$$$$$$$$$$$$$$$$$$$$                
2003-07-29 25     =========================      51122.95 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
2003-07-30 12     ============                   23476.44 $$$$$$$$$$$$$$$$$$$$$$$                 
2003-07-31 18     ==================             36266.76 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

Who needs Reporting Services when you’ve got REPLICATE? 😉

0saves
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.
Tagged , . Bookmark the permalink.

13 Responses to Poor (Wo)Man’s Graph

  1. Pingback: SqlServerKudos

  2. Pingback: Weekly Links Recap for July 31 | Brent Ozar - SQL Server DBA

  3. Jason Strate says:

    Nice, very creative.

  4. BI Boss says:

    Whoever wrote this must be a genius!!

  5. SQLJackal says:

    nice, keep up the good work!!!

  6. Pingback: Log Buffer #157: a Carnical of the Vanities for DBAs | Pythian Group Blog

  7. Pinal Dave says:

    Great. Really I laughed. Nice Work!

  8. Ha ha ha this is awesome! I love it. Old school effectiveness without the new school bloat! Simply cool!

    Manuel

  9. Bob Willsie says:

    You have induced flashbacks to COBOL, FORTRAN, and GECOS assmbler in this decrepit old codger’s mind.

    We used to do things like this because it was “the only way…” %)

  10. Wow, that’s ingenious! I love it.

  11. Jimmy May says:

    This tip is vastly underutilized. I believe I first learned of it in the late, great Ken Henderson Guru’s Guide. Thanks for sharing, Michelle!

  12. What’s up colleagues, good article and good arguments commented at this place, I am really enjoying by these.

  13. Awesome site you have here but I was curious about if you knew of any community forums that cover the same topics talked about here? I’d really like to be a part of online community where I can get opinions from other experienced individuals that share the same interest. If you have any suggestions, please let me know. Appreciate it!

Leave a Reply

Your email address will not be published. Required fields are marked *