Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: Using 2 recordsets


Message #1 by "Joe Ehrenfeld" <joee@v...> on Thu, 23 Aug 2001 14:05:16
I have two recordsets in my code. The first recordset is created via a SQL 

statment. The second recordset is created by by taking a database field 

value from the recordset and using it as a parameter in the second 

recordset sql query. For example myRs.Fields.Item("sku").Value is used in 

the sql query, for the second recordset, 

strQuery = "Select Sku, Sum(Qty) AS qty, Lot, Loc, storerkey from 

LotxLocxID Where StorerKey = 'BUR99' and SKU in ("

strQuery = strQuery & " Select Distinct Sku from Sku Where StorerKey 

= 'BUR99' and SUsr1 = '" & trim(myRs.Fields.item("sku").Value) &"')"

strQuery = strQuery & " Group By Sku, Lot, Loc, storerkey Having Sum(Qty) 

> 0"



The problem I have is that I need to loop the recordsets. And right now 

how I do this is the second recordset loops within the first recordset 

loop. So I have to make a call to the second sql query EVERY time through 

the loop. This is bad as it take awhile for the records to show as well as 

taxing the server. Any ideas how I can avoid this?

Thanks

  Return to Index