Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
ccb-it2013
Contributor
Contributor

How do a join with 2 dbf files?

Hi there,

For the life of me I can't join 2 dbf files so that I can get the necessary data I need from the second database.

In my script I have this:

SELECT * FROM ADO CONMANPO_H

The name of the second dbf I need to get data from is called say CONMANPO_D . They field they have in common is called PONO.

I tried this:

LEFT JOIN CONMANPO_H on  PONO as CONMANPO_D

However I get a script error when I try running the script.

What am I doing wrong?? I am sure it is something really simple.

Thanks for your help!

49 Replies
vishsaggi
Champion III
Champion III

How much data are you trying to pull? Can you do this abort the script and then just run two SELECT statements separately. Like remove Left Join() and just run.

ADOCONMANPO_H:
LOAD *;
SELECT
adoh.Ticket,
adoh.Style,
adoh.Vendor,
adoh.Mfcode,
adoh.duedate
FROM ADOCONMANPO_h adoh;


ADOPLINS:
LOAD *;
SELECT
adoplins.Account,
adoplins.Color,
adoplins.desc,
adoplins.linetot
adoplins.shipno,
adoplins.PONO AS Ticket
FROM ADOPOLINS adoplins;

ccb-it2013
Contributor
Contributor
Author

The script errors out when I trying running the first part:

Qv_2018-04-20_15-05-59.jpg

The same with the second part

Qv_2018-04-20_15-08-55.jpg

The files are not too large:

vishsaggi
Champion III
Champion III

When you run individual files it runs fine right?

sasiparupudi1
Master III
Master III

May be change your driver from oledb to odbc

System Requirements (Visual FoxPro ODBC Driver) | Microsoft Docs

ccb-it2013
Contributor
Contributor
Author

If I run:

SELECT * FROM ADOCONMANPO_H

This is ok.

If I run :

SELECT * FROM ADOPOLINS

This is ok as well.

If I try running the scripts you suggested individually, it errors out.

vishsaggi
Champion III
Champion III

Hmmm. Strange. Can you do this, can you see both the tables in your table viewer?

Press Ctrl+T and check what you see in Tableviewer an paste that snapshot here please

ccb-it2013
Contributor
Contributor
Author

My ERP software developper uses the oledb driver when I commission them to write a report for me. My superiors wish that I learn to write the reports myself.

If they are able to use the OLEDB driver, I should be able too. They don't want to share the information.

ccb-it2013
Contributor
Contributor
Author

See screenshot below when I bring up the table viewer:

Qv_2018-04-20_16-04-58.jpg

vishsaggi
Champion III
Champion III

Can you do one thing. Can you run like below

ODBC Connect.....

Table1:

SELECT * FROM ADOCONMANPO_H;

ODBC Connect.....

Table2:

SELECT * FROM ADOPOLINS;

Then check your tableviewer.

ccb-it2013
Contributor
Contributor
Author

If I try using the ODBC driver, I get the error below:

Qv_2018-04-20_16-15-21.jpg