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 > ANSI SQL > Batch query : NEED HELP!

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-12-04, 08:22
jacky_cheecheo jacky_cheecheo is offline
Registered User
 
Join Date: Jan 2004
Posts: 27
Batch query : NEED HELP!

Hi,

here's my situation...
first i will have to get the location from tblLocation...
there will be:
C:\
D:\
E:\

and then will have to search from these 3 locations one by one (is there a
loop or something like in VB??) starting with C:\ and then D:\ and then E:\.
I will have to do this as i search each drive:
I will have to match the filename that i've searched with another primary
key field of another table tblFiles...
i will match the filename and the primary key, if it match, then i will
update the availability field in tblFiles to 1, else to 0...

I just don't know how to run this all in one shot, can someone teach me
pls...
__________________
Warm Regards,
Jacky
Reply With Quote
  #2 (permalink)  
Old 02-12-04, 09:40
llccoo llccoo is offline
Registered User
 
Join Date: Nov 2003
Posts: 65
Lightbulb Re: Batch query : NEED HELP!

what database are you running? If your running Oracle then you can probably use the stored procedures to do this. Or can probably use perl as well to do something like this.


Quote:
Originally posted by jacky_cheecheo
Hi,

here's my situation...
first i will have to get the location from tblLocation...
there will be:
C:\
D:\
E:\

and then will have to search from these 3 locations one by one (is there a
loop or something like in VB??) starting with C:\ and then D:\ and then E:\.
I will have to do this as i search each drive:
I will have to match the filename that i've searched with another primary
key field of another table tblFiles...
i will match the filename and the primary key, if it match, then i will
update the availability field in tblFiles to 1, else to 0...

I just don't know how to run this all in one shot, can someone teach me
pls...
Reply With Quote
  #3 (permalink)  
Old 02-18-04, 19:52
Bullschmidt Bullschmidt is offline
Guru
 
Join Date: Jun 2003
Location: USA
Posts: 1,032
Example of one query (QueryB) based on the results of another query (QueryA):

QueryA = "SELECT CustID FROM tblCUSTOMERS WHERE CustName = 'A%'"

QueryB = "SELECT CustID, CustName FROM tblCUSTOMERS WHERE CustID IN (" & QueryA & ")"

But the following is even faster and allows for more than one field to be returned in QueryA:

QueryB = "SELECT tblCUSTOMERS.CustID, CustName FROM (" & strSQLA & ") AS tblSQLA INNER JOIN tblCUSTOMERS ON tblSQLA.CustID = tblCUSTOMERS.CustID"

So QueryA would include all the CustID's for customers starting with A.

And QueryB would include more fields in the customers table (i.e. not just the CustID field) for the records returned in QueryA (which was the customers starting with A).

I suppose it wouldn't hurt to always use LEFT JOIN's in QueryB and build from the tblSQLA on the left to other tables that have fields you want to return.
__________________
J. Paul Schmidt, Freelance Web and Database Developer
www.Bullschmidt.com
Access Database Sample, Web Database Sample, ASP Design Tips
Reply With Quote
  #4 (permalink)  
Old 03-30-04, 15:25
jacky_cheecheo jacky_cheecheo is offline
Registered User
 
Join Date: Jan 2004
Posts: 27
thank you all, i've got the solution...!
__________________
Warm Regards,
Jacky
Reply With Quote
  #5 (permalink)  
Old 03-31-04, 18:56
llccoo llccoo is offline
Registered User
 
Join Date: Nov 2003
Posts: 65
wanna put up the solution ? =)

Quote:
Originally posted by jacky_cheecheo
thank you all, i've got the solution...!
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On