How to merge two ADO RecordSets into one 
Author Message
 How to merge two ADO RecordSets into one
What is the best way to combine two ADO RecordSets into one ADO RecordSet?
Both ADO RecordSets have the same field names.

Thanks.

--

Peace in Christ,
Marco Napoli
http://www.***.com/



Mon, 28 Jun 2004 06:32:13 GMT
 How to merge two ADO RecordSets into one

Assuming that the underlying database supports it, use the UNION
operator.  For example

(SELECT stuff FROM Table1) UNION (SELECT stuff FROM Table2)

would generate a single recordset.  As additional cool functionality, it
is possible to sort and group across both SELECTs by placing the ORDER
BY and GROUP BY keywords outside the UNION.

((SELECT1) UNION (SELECT2)) ORDER BY Field1

Gosh this SQL is cool sometimes. :)

Bruce Johnson
TAG Consulting

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Mon, 28 Jun 2004 09:06:07 GMT
 How to merge two ADO RecordSets into one
Exelent, I am using SQL Server 7.0 so it should work. I will be using your
idea of putting Group By and Order By, which I needed to use.

Thank you
Marco


Quote:
> Assuming that the underlying database supports it, use the UNION
> operator.  For example

> (SELECT stuff FROM Table1) UNION (SELECT stuff FROM Table2)

> would generate a single recordset.  As additional cool functionality, it
> is possible to sort and group across both SELECTs by placing the ORDER
> BY and GROUP BY keywords outside the UNION.

> ((SELECT1) UNION (SELECT2)) ORDER BY Field1

> Gosh this SQL is cool sometimes. :)

> Bruce Johnson
> TAG Consulting

> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



Mon, 28 Jun 2004 13:27:55 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. Merging Data from TWO databases into One recordset???

2. Two ADO recordset into one

3. Paradox merging two text fields into one one

4. How to use ADO to create one to one relationship between two tables

5. Merging two tables into one

6. Merging two result set rows into one???

7. How to merge two tables into one ?

8. How do I merge Two DateTime values into one

9. merging two fields into one field with value lists

10. merge two columns into one

11. Merging two tables into one

12. One SQL Query To Merge Two Databases


 
Powered by phpBB® Forum Software