Thanks for the ideas, Dan.  I'm making progress!

----- Original Message ----- From: "Dan Nelson" <[EMAIL PROTECTED]>
To: "Sue Cram" <[EMAIL PROTECTED]>
Cc: <mysql@lists.mysql.com>
Sent: Sunday, February 13, 2005 12:34 AM
Subject: Re: Total Counts, Multi-Report Questions



In the last episode (Feb 12), Sue Cram said:
I have a request for a list of database entries "Select x,y,z, etc"
that is now working OK.  I have several questions, however.  Here
they are:

  1.. Can I add a "total" line at the bottom of the report (ex:
  "Total Selected: 23") for the total number of entries that are
  listed in the report?

It's your report, you can put whatever you want in :) Simply print the size of the resultset of your main query, or if whatever language/reporting tool you're using can't do that, just do a SELECT COUNT(*) with the same WHERE clause.

  2.. I want to print the same information but sorted in a different
  order on a second page of the report.  Can I do that in one
  "Select" statement?

If your language supports it, you can re-sort your resultset with a custom comparison fuction and display it again. Otherwise, you'll need another SELECT.

  3.. If I need multiple select statements, is there a delimiter that
  says "This is the end of my first select statement - the next thing
  you see is going to be a new select statement", so that all the
  necessary pages can be printed together in one "job"?

So you want the same records to be returned in two orders, but as one resultset? Stick two queries together with a UNION ALL keyword.

http://dev.mysql.com/doc/mysql/en/union.html

--
Dan Nelson
[EMAIL PROTECTED]



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to