It's been awhile since I've done this, but couldn't you build a pivot table in 
Excel that would bring the data through ODBC? I did this before for a report 
I needed. You can get very granular about what data goes where in Excel and 
avoid the need for a bloated macro. Once the data sources and the spreadsheet 
are set up, you can refresh the data with a mouse click. This may not be 
doable in your situation. I was connecting to MS Access, but from the point 
of view of Excel, it was just another ODBC source.

On Wednesday 01 May 2002 09:01 am, Jay Blanchard wrote:
> Howdy,
>
> I need to write some data out to Excel spreadsheets for some of our
> managers to muddle with for projections. The query works fine...
>
> SELECT RecordID, RecordDate, count(*) AS Quantity
> FROM tblFOO
> Group By RecordID, RecordDate
>
> It returns;
> +----------+------------+----------+
>
> | RecordID | RecordDate | Quantity |
>
> +----------+------------+----------+
>
> | 100101   | 2002-03-21 |     6675 |
> | 100101   | 2002-03-22 |     6794 |
> | 100101   | 2002-03-23 |     2916 |
> | 100101   | 2002-03-24 |     1215 |
> | 100101   | 2002-03-25 |     6152 |
> | 100101   | 2002-03-26 |     5398 |
>
> +----------+------------+----------+
>
> as expected (Only a subset here, there are hundreds of rows). I want to
> place this data like this in an Excel table (bad ascii art example to
> follow);
>
> +------------+--------+--------+--------+
>
> | RecordID   | 100101 | 100120 | 100131 |
>
> +------------+--------+--------+--------+
>
> | Date       |        |        |        |
>
> +------------+--------+--------+--------+
>
> | 2002-03-01 |        |     12 | 130101 |
>
> +------------+--------+--------+--------+
>
> | 2002-03-21 |   6675 |        |   1113 |
>
> +------------+--------+--------+--------+
>
> | 2002-03-22 |   6794 |    287 |  29045 |
>
> +------------+--------+--------+--------+
>
> | 2002-03-23 |   2916 |      6 | 233427 |
>
> +------------+--------+--------+--------+
>
> RecordID along the top row, dates down the side, quantities at the
> intersection that they belong. I could get an OBDC connection from Excel to
> MySQL and then write a complicated macro to do this, or if posssible (which
> is what I am really looking for) I would like to SELECT..INTO..OUTFILE an
> Excel file with the proper formatting.
>
> Any suggestions?
>
> Thanks!
>
> Jay Blanchard
>
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
> <[EMAIL PROTECTED]> Trouble
> unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to