CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 1999
    Location
    RS, Brasil
    Posts
    9

    Running a query that retrieve data from more than one table

    Hi

    Is it possible to run a query that retrieve data from more than one table using the CRecordset class?
    Ex: "Select Table1.Name from Table1,Table2 where Table1.Number = Table2.Number "


    If so, how can I do this?

    thanks...


  2. #2
    Join Date
    Apr 1999
    Location
    Delhi, India
    Posts
    32

    Re: Running a query that retrieve data from more than one table

    Try this :
    select distinctrow Table1.Name <and other fields...>
    from Table1 inner join Table1 on Table1.Number = Table2.Number


    Rajaraman

  3. #3
    Join Date
    May 1999
    Location
    RS, Brasil
    Posts
    9

    Re: Running a query that retrieve data from more than one table

    Hi....

    Can you send me an example code to use this query?

    Thanks.....


  4. #4
    Guest

    Re: Running a query that retrieve data from more than one table

    In your GetDefaultSQL function return

    "Select Table1.Name from Table1,Table2"

    Then when before you Requery, set m_strFilter = "Table1.Number=Table2.Number"
    and execute Requery().


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured