Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2007
    Posts
    5

    Question Unanswered: Could use help writing query in script

    I am trying to figure out a simple yet efficent way to write a query that can query multiple tables that have the same fields with information in it.... heres what i wrote so far but its not working... this may help you understand what im trying to do if you dont understand....

    x=1

    filename="dogs"

    while x>0

    tblVar.attach(":dogs:"+filename+string(x)+".db")

    if isTable(tblVar)=true then

    Que =

    Query

    SORT: tblVar->"CNUM"

    tblVar | CNUM | LASTUPDATED | CKNUM | ONUM | Okey | Prevonum |
    | Check | Check | Check | Check | Check | Check |

    endQuery

    Que.executeQBE(":dogs:answer"+string(x)+".db")

    else
    return
    endif
    x=x+1
    endwhile

    Basically i have multiple tables that are structured the same that have records in them, and i am trying to figure out the best way to query out information from all the tables simultaneously, ex: if i want to look up all the flavors that are chocolate in my tables, i would want to query thru all the tables on the Flavor field and get all the records added to 1 answer table. Which above i dont have that written correctly either, IF the above worked it would query one table and write an answer table, then after querying the next table write another answer table.. i dont want it to do that, i want it to write to 1 table. Any help or ideas are appreciated, thank you!
    Last edited by S0nY; 04-10-07 at 17:31.

  2. #2
    Join Date
    Aug 2003
    Location
    Bologna - Italy
    Posts
    209
    There is a parameter for the query that states which answer table should be used, you could use this to put all the results in a single answer table.
    The only failure is not trying to do it.

Posting Permissions

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