I'm using it to get a count of records so I can do paging in a web page,
display the number of records in the result, as well as the total pages that
are available.

Bradley V. Stone
BVSTools - www.bvstools.com
eRPG SDK - www.erpgsdk.com

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx]On Behalf Of Joe Pluta
Sent: Thursday, March 13, 2008 3:57 PM
To: Midrange Systems Technical Discussion
Subject: Re: SQL Question - Merging files or result sets?


Bradley V. Stone wrote:
Alan,

I was wondering if using a union on two files if I can
construct a single
count(*) SQL command to count the total records from both files.

Brad, there are probably three or four ways to do what you're asking,
but it will help if you give a business reason. For example, I can get
you all the records from one file, followed by a row with the record
count, then all the records from the second file, followed by a count.
But remember that the result set must have the same columns in every
row, so you end up with an additional column for the file name (which
will be one of two values) and an addition column for the count (which
will be zero for every records EXCEPT the two total records).

You can also do two queries, one which gets you all the detail, and a
second which give you a single row with both counts (or two rows, each
with a count and a filename).

It really depends on what you're going to do with the data.

Joe
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L)
mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.