how to join two recordsets? 
Author Message
 how to join two recordsets?

Hi, Pal,
I have two tables, TableA and TableB, in a database and have two
corresponding recrodsets, CRecrodsetA and CRecordsetB.
I know we can join the two tables by putting them in one recordset. But what
if I want to keep two separate recordset classes and join the two
recordsets?
The query will be something like:
SELECT a.Salary
FROM TableA a, TableB b
WHERE a.StartingTime >= b.StartingTime AND a.Salary < b.Salary

Any idea is appreciated.
Wenhai



Sat, 05 Nov 2005 23:34:42 GMT  
 how to join two recordsets?

Quote:
> Hi, Pal,
> I have two tables, TableA and TableB, in a database and have two
> corresponding recrodsets, CRecrodsetA and CRecordsetB.
> I know we can join the two tables by putting them in one recordset. But
what
> if I want to keep two separate recordset classes and join the two
> recordsets?
> The query will be something like:
> SELECT a.Salary
> FROM TableA a, TableB b
> WHERE a.StartingTime >= b.StartingTime AND a.Salary < b.Salary

Can't be done.

The best that you can do is

1. Clone one of the recordsets (maybe smallest) (and that means client-sided
cursor)
2. Requery original recordset (now the Clone is independent)
3. Add records to cloned recordset from 2nd recordset reading fields.

Stephen Howe



Sun, 06 Nov 2005 02:22:17 GMT  
 how to join two recordsets?
class CJointRecordset {
public:
    CJointRecordset (CRecordset a, CRecordset b);

    // cursor operations
    virtual void MoveNext();
    virtual void MovePrev();
    virtual void MoveFirst();
    virtual void MoveLast();

    etc.

Quote:
};

class HealtJointRs : public CJointRecordset {
    void MoveNext() {
        // just add logic here
    }

    etc.

Quote:
};



Quote:
> Hi, Pal,
> I have two tables, TableA and TableB, in a database and have two
> corresponding recrodsets, CRecrodsetA and CRecordsetB.
> I know we can join the two tables by putting them in one recordset. But
what
> if I want to keep two separate recordset classes and join the two
> recordsets?
> The query will be something like:
> SELECT a.Salary
> FROM TableA a, TableB b
> WHERE a.StartingTime >= b.StartingTime AND a.Salary < b.Salary

> Any idea is appreciated.
> Wenhai



Mon, 07 Nov 2005 01:23:51 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. how to join two recordsets?

2. how to join two recordsets?

3. how to join two recordsets?

4. Updating records in a recordset defined by an SQL join

5. How to create Recordset of joined table

6. ODBC Recordset JOIN & Update

7. Join two arrays

8. Joining two tables in Visual C++

9. Joining two tables from SQL server in Visual C++ 6

10. How to join two recordsers in ADO

11. Can I join Two tables from diffrent databse

12. Problem writing to two database tables that are joined ( CRecordSet read-only)

 

 
Powered by phpBB® Forum Software