Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2003
    Posts
    4

    Question Unanswered: Opening Multiple SQL queries into a recordset.

    okay my problem:

    I have to open 4 SQL statements into a new record set. and then sort the recordset.

    I have created strSQL1, strSQL2, strSQL3 and strSQL4. and would like them all to opened into oRSrecord.

    I have tried:

    oRSrecord.open strSQL1,strSQL2,strSQL3,strSQL4,oCM

    but does not work.

    can anyone help?

    I would also like to sort this recordset once created. i believe oRSrecord.sort "date04" should work. date04 being the column by which i would like to sort by.

    Thank you for the help!!

    Dominic

  2. #2
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    Why do you need 4 separate SQL statements? If each one of them pulls data from different tables, then you need to join all the tables based upon their keys. You should only need one (and potentially more sub-queries). Can you give us an example of what the 4 SQL statements are?

  3. #3
    Join Date
    Sep 2003
    Posts
    4
    okay I have 1 table called courses with around 20 columns. each course can appear in 4 categories. so i need to go through searching the database 4 times each time on a different category. Therefore needing the four sql statements. then when inserted into the recordset, i can sort the courses by category.

    ...is there also maybe a way i can do this with a UNION? although i would like to know for future reference if its possible to combine several SQL statments in one recordset.

    thanks

    Dominic

  4. #4
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    Are the 4 categories exclusive, or can a course be in more then one category at the same time?

    Using "ORDER BY" or "GROUP BY" clauses may get you what you need. It wouldn't be different recordsets, but one.

  5. #5
    Join Date
    Sep 2003
    Posts
    4
    no, each course can have a category in each of the category fields i.e. a course can belong to 4 categories at once. thats what makes it complicated!

    so there is no way of combining to recordsets? or in this case 4.

    thank you for all this help!

    Dominic

  6. #6
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    Oh.. so "category" is actually 4 different columns in the table? What data types are they.. bit?

  7. #7
    Join Date
    Sep 2003
    Posts
    4
    yes, cat1,cat2,cat3,cat4 ... for each course!

Posting Permissions

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