Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query a recordset

Status
Not open for further replies.

GerryGoldberg

Technical User
Apr 12, 2001
55
I would like to select some records like:

set rst1 = dbs.openRecordset("SELECT * FROM tableA WHERE state = 'OH')

Then, based on the resulting recordset, I would like to do an additional query, like:

set rst2 = "COUNT (*) FROM (the recordset rst1) WHERE City='CLEVELAND'"

How can I reference rst1 in my second query?

Thanks,

Gerry Goldberg
 
Hi, Gerry!

Why don't you create one query with both criterias?

set rst1 = dbs.openRecordset("SELECT Count(*) AS RecordsCount FROM tableA WHERE state = 'OH' AND City='CLEVELAND'")

Aivars
 
This example is only one of a set of operations that I have to do with this data. For example, I need to establish a base recordset of data from a specific state, e.g. rst1. Then I need to extract a number of different kinds of data from this recordset, such as average age of those clients from Cincinnati, or types of housing for those clients in Toledo, etc. I'm trying not to have to re-create the base recordset over again for each subsequent set of data that I need. Would this be easier to use filtering with the recordsets?

Thanks,

Gerry Goldberg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top