Link to home
Start Free TrialLog in
Avatar of arreegua
arreeguaFlag for Brazil

asked on

SQL Statemente to Join multiple DBF´s in differents directorys with TQuery

I work with a basic software to control my products, it is a really simple program and with it is not possible to control more than one shop. Well now i have 3 shops and still using this lame program, im working like this now:
c:\teste\shop1
c:\teste\shop2
c:\teste\shop3

Well, my question is how to make a SQL statement in Tquery(Delphi)  joinning the table named ESTOQUE.DBF from each shop directory:
The primary Key in ESTOQUE.DBF is CODIGO, and i want to view the fileds DESCRICAO and QTD_ATUAL

Thank you in advance for any help
Avatar of arreegua
arreegua
Flag of Brazil image

ASKER

i tryed this but doesnt woked

select "c:\teste\shop1\estoque.dbf".codigo, "c:\teste\shop1\estoque.dbf".descricao, "c:\teste\shop1\estoque.dbf".qtd_atual, "c:\teste\shop2\estoque.dbf".qtd_atual, "c:\teste\shop3\estoque.dbf".qtd_atual from "c:\teste\shop1\estoque.dbf" inner join "c:\teste\shop2\estoque.dbf" on "c:\teste\shop1\estoque.dbf".codigo = "c:\teste\shop2\estoque.dbf".codigo inner join "c:\teste\shop1\estoque.dbf".codigo = "c:\teste\shop3\estoque.dbf".codigo
ASKER CERTIFIED SOLUTION
Avatar of Geert G
Geert G
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
How can i rename the duplicated columns? I ll try the code and post reply soon
just put the new name after the column
B
.
qtd_atual qtd_atual_B

you can optionally do it with as in between the 2

B
.
qtd_atual as qtd_atual_B

Open in new window

Thank you very much