2012年2月16日星期四

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...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.

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...|||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.|||thank you all, i've got the solution...!|||wanna put up the solution ? =)

Originally posted by jacky_cheecheo
thank you all, i've got the solution...!

没有评论:

发表评论