0
votes

Basically i'm trying to do a simple join. I'm a beginner in progress and even if i'm reading always the same things... my problem still unresolved ! :'( I'm using unixodbc to communicate with my base and this is working like a charm when i'm using simple command like : SELECT * from PUB."Art"

I understood I have to do something who looks like that to join 2 tables :

FOR EACH PUB."Art" WHERE (PUB."Art".IdArt = 16969) ,
    EACH PUB."ArtDet" WHERE (PUB."ArtDet".IdArt = PUB."Art".IdArt)
END

But this only return me [ISQL]ERROR: Could not SQLPrepare

I then try to simplify the thing with :

for each PUB."Art": display PUB."Art".IdArt end.

I try to put colon (or not) after the for each loop, using point / comma etc... but I never use the right syntax apparently... or I'm missing a thing to execute this command !

Is anyone can advice me ? Thx a lot !

1

1 Answers

1
votes

You appear to mixing SQL and 4GL syntax.

"FOR EACH" is 4GL. The SQL equivalent is "SELECT".

(If you are using 4GL you do not need then "PUB" prefix and quoting table and field names will not work.)

To do a join with SQL (or the 4GL) use a "," between the table names. For SQL your syntax would look something like:

SELECT * from PUB."Art", PUB."ArtDet"

Gory details regarding WHERE clauses, SQL INNER & OUTER joins etc. can be found in the online documentation:

https://community.progress.com/community_groups/openedge_general/w/openedgegeneral/1329.openedge-product-documentation-overview

You will want to navigate to your specific release and then find the "SQL" guide.