Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2004
    Posts
    27

    Unanswered: 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

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


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

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

  4. #4
    Join Date
    Jan 2004
    Posts
    27
    thank you all, i've got the solution...!
    Warm Regards,
    Jacky

  5. #5
    Join Date
    Nov 2003
    Posts
    65
    wanna put up the solution ? =)

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

Posting Permissions

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