Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Can I run a SELECT query against a Recordset object?


Message #1 by doug.hughes@j... on Fri, 19 Jan 2001 13:15:58 -0000
I currently construct a fairly complicated SQL select statement, based on

form data, which involves several joined tables (MS Access). The result of

the query is held in a recordset object.



Before I display the results to the user I need to determine a list of

unique values of one of the fields in the recordset. Specifically, a

"status" field for which I want to provide an explanation key at the top

of the page. The idea is that I will only display explanations for those

statuses that are actually present in the selected records.



Is it possible to run a query along the lines of "select [Status] from

[recordset] group by [Status]" where [recordset] is my original Recordset

object?



I know I could run a separate query, involving all the same linked tables,

but only selecting the [Status] field and grouping on it, but it would

seem an inefficient approach as it must search through the entire tables

again, rather than the subset that the existing recordset holds.



Alternatively I could step through all of the records in the recordset and

manually compile an array/list of unique values, but again this seems like

a lot of unecessary work/processing that could be avoided.



Any help would be appreciated. Thanks in advance.



Doug Hughes


  Return to Index