Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
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
ccb-it2013
Contributor
Contributor
Author

Hi Sasidhar,

For some reason what you suggested does not work:Qv_2018-04-19_14-02-58.jpg

The database files are Visual FoxPro 9.x.

Is there something I am not understanding?

Thanks!

vishsaggi
Champion III
Champion III

Are you still having issues joining these tables? Can you paste your actual script where you getting this error?

ccb-it2013
Contributor
Contributor
Author

Hi Vishwarath,

This is the script I have:

SET ThousandSep=',';

SET DecimalSep='.';

SET MoneyThousandSep=',';

SET MoneyDecimalSep='.';

SET MoneyFormat='$#,##0.00;($#,##0.00)';

SET TimeFormat='h:mm:ss TT';

SET DateFormat='M/D/YYYY';

SET TimestampFormat='M/D/YYYY h:mm:ss[.fff] TT';

SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';

SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';

OLEDB CONNECT32 TO [Provider=VFPOLEDB.1;Data Source=G:\AIMS\QVDATA\CMP4\;Collating Sequence=general;];

SELECT * FROM ADOCONMANPO_h

SELECT * FROM ADOCONMANPO_h ADOPOLINS

LEFT JOIN

ADOCONMANPO_H ADOPOLINS

ON ADOCONMANPO_H.PONO=ADOPOLINS.PONO

This is error I get:

Qv_2018-04-19_14-53-04.jpg

This table 1:

jas_2018-04-19_14-50-59.jpg

This is the table I need join to:

jas_2018-04-19_14-52-21.jpg

Ticket in table 1 contains the same reference in table 2 under field PONO

What I need is to be able access the fields in table 2 for the report.

What am I doing wrong? I understand to join two tables, you need a common reference or key.

Please advise.

Thanks!

vishsaggi
Champion III
Champion III

NO this is not how you do a join. Try below and you have to mention what fields you want to pull from both the tables. If you have field which are similar in both the tables you need to specify from which table you want that common field to be displayed.

And are you trying to do a self join here? If yes you have to mention the fields appropriately. Can you provide what fields you want to display in your final report. Your script says you are joining the same table.

ccb-it2013
Contributor
Contributor
Author

Hi Vishwarath,

Thank you for your patience and guidance. Much appreciated.

From the first table I need:

Ticket, Style, Vendor, Mfcode, duedate

From the second table :

Account, Color, desc, linetot (quantity of color), Shipno

vishsaggi
Champion III
Champion III

Ok. one last thing what is the table name for First table and the table name for Second table?

ccb-it2013
Contributor
Contributor
Author

The first table name is ADOCONMANPO_h

The second table name is ADOPOLINS

Many thanks!

vishsaggi
Champion III
Champion III

Try this! If I did not enter the table names try to change accordingly.

OLEDB CONNECT32 TO [Provider=VFPOLEDB.1;Data Source=G:\AIMS\QVDATA\CMP4\;Collating Sequence=general;];
SQL
SELECT adoh.Ticket,
adoh.Style,
adoh.Vendor,
adoh.Mfcode,
adoh.duedate,
adoplins.Account,
adoplins.Color,
adoplins.desc,
adoplins.linetot
adoplins.shipno
FROM ADOCONMANPO_h adoh
LEFT JOIN
ADOPOLINS adoplins
ON adoh.Ticket = adoplins.PONO;

ccb-it2013
Contributor
Contributor
Author

HI VIshwarath,

The names are good, but I am still getting the same error...

sasiparupudi1
Master III
Master III

May be there is no field called pono?

In your previous replies you said code ran well with the join

ON adoh.TICKET = adod.TICKET  ?


May be change

ON adoh.Ticket = adoplins.PONO to above stmt