If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Opening Multiple SQL queries into a recordset.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-03-03, 06:27
dominiccort dominiccort is offline
Registered User
 
Join Date: Sep 2003
Posts: 4
Question 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
Reply With Quote
  #2 (permalink)  
Old 09-03-03, 10:22
Seppuku Seppuku is offline
Useless...
 
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?
Reply With Quote
  #3 (permalink)  
Old 09-03-03, 15:02
dominiccort dominiccort is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 09-03-03, 15:29
Seppuku Seppuku is offline
Useless...
 
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.
Reply With Quote
  #5 (permalink)  
Old 09-03-03, 16:35
dominiccort dominiccort is offline
Registered User
 
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
Reply With Quote
  #6 (permalink)  
Old 09-03-03, 16:56
Seppuku Seppuku is offline
Useless...
 
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?
Reply With Quote
  #7 (permalink)  
Old 09-03-03, 17:55
dominiccort dominiccort is offline
Registered User
 
Join Date: Sep 2003
Posts: 4
yes, cat1,cat2,cat3,cat4 ... for each course!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On