Unable to create a usefull chart from mySQL Data

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • CoreyReynolds
    New Member
    • Nov 2009
    • 29

    Unable to create a usefull chart from mySQL Data

    Hello all,

    I have some VB code that spits an Access query out into Excel and attempts to create a chart from it. The problem is it spits it into a format that Excel can't really eloquently make a chart out of, see:

    Code:
    equipmentID	sampleDate	Cu
    26255	11/22/2009	2
    26255	11/23/2009	60
    26255	11/26/2009	5
    26646	11/22/2009	33
    26646	11/24/2009	12
    26646	11/15/2009	1
    Now (unless someone can state an easy way to create an excel chart that would list one line as each piece of equipment from the above in a line graph with dates along the bottom and level of Cu on the side...) since this data format kind of sucks can anyone think of a query format that would create a nicer table to work with in Excel?

    equipmentID belongs to a table called tblEquipment that has a relationship to tblSample where the other two fields lay.

    I'll be doing the chart procedurally in VB which isn't a big deal, but keep in mind manually clicking and changing things isn't going to work - I need to pretty much be able to select the entire data range and be able to excel to chart it properly.

    Going like the following for example would fix all of my problems, but I'm not really sure how to do it:
    Code:
    EquipID 11/01/09 11/02/09 11/03/09
    026548        2            -             3
    033215        1            5             -
    Thanks!
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hey.

    How does this relate to MySQL?
    Only things you mention in your post is VB, Access and Excel, none of which has anything to do with MySQL.

    Comment

    • CoreyReynolds
      New Member
      • Nov 2009
      • 29

      #3
      I was wondering if there was a mySQL query possible that could organize the data more like the second format I posted.

      Comment

      • code green
        Recognized Expert Top Contributor
        • Mar 2007
        • 1726

        #4
        If querying from Excel, you need to stick to MsSQL.
        You connect to the spreadsheet as if it is a database.
        MySQL has no advantage over MsSQL in the environment you describe

        Comment

        • nbiswas
          New Member
          • May 2009
          • 149

          #5
          Answer to Unable to create a usefull chart from mySQL Data

          This kind of problems are known as CrossTab Queries and can be solved using PIVOTING.
          I could have easily done this using SQL SERVER(I am a SQL SERVER guy purely and shares little knowledge as of now in MySql) but since your requirement is in MySql, so you can have a look here

          Common MySQL Queries

          In the right side of this page you will find "Pivot tables" which shows 5 different ways of doing PIVOTING.

          You can get the concept and go ahead.

          Sorry, in MySql I cannot help you more apart from this at present

          Comment

          • CoreyReynolds
            New Member
            • Nov 2009
            • 29

            #6
            You're all so right with the Pivoting. I went back and rebuild some stuff and it's exactly what I needed. Thanks again folks.

            Comment

            Working...