By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,142 Members | 1,937 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,142 IT Pros & Developers. It's quick & easy.

Perform functions on recordset?

P: n/a
Is it possible to perform functions on a recordset (rather than on the
source database), e.g. COUNT, MAX etc

The reason I would like to do this is because I have a hugely complex view
which produces results with over 60 columns of data. I would like to display
all data but also highlight individual "cells" in the table which have the
highest (i.e. MAX) data for each column. I would also like totals at the
bottom of each column.

Obviously I could get the MAX value for each column by performing it on the
SQL data but that would effectively mean running the query twice and would
take twice as long.

Any suggestions?
Aug 8 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Mika wrote:
Is it possible to perform functions on a recordset (rather than on the
source database), e.g. COUNT, MAX etc
Not without time-and-resource-consuming looping.

The reason I would like to do this is because I have a hugely complex
view which produces results with over 60 columns of data. I would
like to display all data but also highlight individual "cells" in the
table which have the highest (i.e. MAX) data for each column. I would
also like totals at the bottom of each column.

Obviously I could get the MAX value for each column by performing it
on the SQL data but that would effectively mean running the query
twice and would take twice as long.

What database are you using? Does "SQL data" imply that you are using SQL
Server? if so, what version? T-SQL provides CUBE and ROLLUP functionality
which may provide what you are looking for. If you are using SQL Server, you
should look up these terms in Books Online (BOL).

You should test this, but I submit that "running the query twice" would
outperform retrieving the data and looping through it to perform your
aggregations.

You can use subqueries to achieve most of your objectives in a single query.

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Aug 8 '05 #2

P: n/a
This is fairly simple with Reporting Services.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

"Mika" <mi**@hotmail.com> wrote in message
news:OF****************@TK2MSFTNGP14.phx.gbl...
Is it possible to perform functions on a recordset (rather than on the
source database), e.g. COUNT, MAX etc

The reason I would like to do this is because I have a hugely complex view
which produces results with over 60 columns of data. I would like to
display all data but also highlight individual "cells" in the table which
have the highest (i.e. MAX) data for each column. I would also like totals
at the bottom of each column.

Obviously I could get the MAX value for each column by performing it on
the SQL data but that would effectively mean running the query twice and
would take twice as long.

Any suggestions?

Aug 8 '05 #3

P: n/a
Mika,

You might find the QueryRecordsets component I've been working on useful.
Its allows you to issue SQL queries against ADO recordsets. COUNT and MAX
are just two of the many builtin functions supported.

It lets you perform complex SQL SELECT statements including UNION, JOINS,
GROUP BY, HAVING, ORDER BY, sub-queries, functions, aggregates against the
ADO recordsets..

This component allows applications like Visual Basic 6.0 to register ADO
recordsets into a DataSet collection, perform complex SQL queries and return
the results as an ADO recordset.

For a trial download or more information, please visit
http://www.queryadataset.com/recordsets.aspx

Thanks
Adrian Moore

Peersoft

"Mika" <mi**@hotmail.com> wrote in message
news:OF****************@TK2MSFTNGP14.phx.gbl...
Is it possible to perform functions on a recordset (rather than on the
source database), e.g. COUNT, MAX etc

The reason I would like to do this is because I have a hugely complex view
which produces results with over 60 columns of data. I would like to
display all data but also highlight individual "cells" in the table which
have the highest (i.e. MAX) data for each column. I would also like totals
at the bottom of each column.

Obviously I could get the MAX value for each column by performing it on
the SQL data but that would effectively mean running the query twice and
would take twice as long.

Any suggestions?

Aug 9 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.