[snip 1]
You could do that for the RecordID if you do not know what they are (I
knew what RecordID's existed, so I could specifiy an IF statement for each).
If I remember correctly you could even have SQL produce do the code for you.
In PHP you could do it any number of ways (pseudocode follows - untested,
YMMV);

$query1 = "SELECT DISTINCT RecordID ";
$query1 .= "FROM tblFOO ";

$query2 = "SELECT RecordDate, ";
$db1 = mysql_query($query1, $dbconnect)
while($dbrow = mysql_fetch_object($db1)){
        $query2 .= "IF(RecordID=$dbrow->RecordID,count(*),0) AS
$dbrow->RecordID,
";
        }
$query2 .= "FROM tblFOO ";
$q11 .= "GROUP BY RecordDate ";

Now, IF THIS WORKS (I will repeat that I have not tested it), it would
be very convenient. I may have made some small syntax errors, if I get the
chance I will try it later. If you try it and it works let me know.
[/snip1]

[snip2]
Yeah, that's about what I thought too.  Certainly looks like it would
work.  Depending on the size of the table you end up doing two fairly
large db calls, but that's gotta be faster and simpler than all the
other data manipulation.

You could then add "Into outfile blah blah", and get it all done at
once, right?
[/snip2]

In this case I am not doing INTO OUTFILE (though you could). I am placing
the query in a PHP page that is set to MIME M$ Excel so that the fields/data
are retrieved into a spreadsheet so that management can muck around with
numbers without destroying the original data.

Thanks!

Jay




---------------------------------------------------------------------
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