|
-
Apr 1st, 2004, 05:33 AM
#1
Thread Starter
Fanatic Member
ASP, VBscript, SQL Union Select and Record sets [Resolved]
I am devloping a new "function" for an ASP website. It is programmed purely in VBscript and uses a Micosoft Access Database.
A loop is used to build an extensive union query. Each loop adds a line such as "...2 as Rel..." the number changes with each iteration dependant on a large array of different factors.
Once we have this huge resord set from the database we will have a list where every entry appears up to Sixty times with only the Rel field being unique to any given line.
What I now want to do is "Sum" on Rel and "Group by" on everything else. I hope there is a way to use SQL on my record set to pull a new record set from it.
I am also hopeing that it does not mean writing a new table in the database each time to do it.
What is the fastest way (In terms of server time) to get to the desired end result? (given that the database is huge and likely to grow endlessly untill we are forced to move to SQL server!)
Last edited by Matt_T_hat; Apr 5th, 2004 at 04:58 AM.
-
Apr 1st, 2004, 05:40 AM
#2
Well, assuming that your union (huge) query is inna string, you need to make it a subquery :
Select field, field, (...etc) ,sum(rel) as sumofrel
From
(
union query here
)
If your union query is run to put the data in a table, which I doubt as you wouldn't have posted up otherwise, then you can do the above but on that table.
Why would you want to sum the `rels` anyway?
Vince
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Apr 1st, 2004, 06:07 AM
#3
Thread Starter
Fanatic Member
Originally posted by Ecniv
Well, assuming that your union (huge) query is inna string, you need to make it a subquery :
Select field, field, (...etc) ,sum(rel) as sumofrel
From
(
union query here
)
You can do that!?! Fantastic! That's easy then. Thank you.
Originally posted by Ecniv
Why would you want to sum the `rels` anyway?
The Sum of Rel should indicate the RELivence of a search term based on how many times it shows up and where.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|