List:General Discussion« Previous MessageNext Message »
From:Dan Nelson Date:February 13 2005 8:34am
Subject:Re: Total Counts, Multi-Report Questions
View as plain text  
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.

	Dan Nelson
Total Counts, Multi-Report QuestionsSue Cram13 Feb
  • Re: Total Counts, Multi-Report QuestionsDan Nelson13 Feb
  • Re: Total Counts, Multi-Report QuestionsSue Cram14 Feb