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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can a query be run on separate tables in RS

Status
Not open for further replies.

DCount

Programmer
Mar 10, 2005
4
US
I have a very complex query that needs to return monthly and year-to-date data. I'm using one table (table A) to correctly return the monthly data. I would now like to create another table and use a result from table A to correctly filter and display the year-to-date data along side the monthly data.

Does RS allow querying between tables?

Thanks
 
Not sure what you mean?
The RS (recordset) contains whatever you put in it, so if you want both tables, where they match you can do stuff like
set rs = myConn.Execute "SELECT * from MyTableA inner join MyTableB on MyTablea.id = MyTableB.id"

this joins both tables, alternatively you can use the union statement
set rs = myConn.Execute "SELECT * from MyTableA UNION ALL SELECT * FROM MyTableB" --on the provision column number and types match.



"I'm living so far beyond my income that we may almost be said to be living apart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top