Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL - Litle problem...
Message
From
13/04/2000 21:31:45
 
 
To
13/04/2000 19:27:36
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00359564
Message ID:
00359609
Views:
8
Hi João,

It looks like the ON clauses of the nested JOIN's are reversed. If you want to use nested JOIN's, try
...
LEFT OUTER JOIN jbfic!documentos ;
   LEFT OUTER JOIN jbfic!clientes ;
   ON  Documentoscabcli.c_codcli = clientes.c_codigo ;
ON  Documentoscabcli.c_tipodoc = Documentos.c_codigo ;
...
Otherwise you could change the syntax so the JOINS are written serially, as in
...
LEFT OUTER JOIN jbfic!documentos ;
   ON  Documentoscabcli.c_tipodoc = Documentos.c_codigo ;
LEFT OUTER JOIN jbfic!clientes ;
   ON  Documentoscabcli.c_codcli = clientes.c_codigo ;
...
As a side note, it's also a good idea to leave a space before all semi-colons, otherwise the SQL syntax parser may not separate things the way you intended.

HTH,
Rick
>Hi all,
>
>I got an error only when i run this code for the first time only
>
>lcP="010101000001"
>lcU="010101000005"
>
>SELECT * ;
> FROM jbfic!documentoscabcli INNER JOIN jbfic!documentoslincli ;
> on Documentoscabcli.c_tipodoc = documentoslincli.c_tipodoc;
> AND Documentoscabcli.c_armazem = documentoslincli.c_armazem;
> AND Documentoscabcli.c_cod_ser = documentoslincli.c_cod_ser;
> AND Documentoscabcli.c_numdoc = documentoslincli.c_numdoc;
> AND BETWEEN(Documentoscabcli.C_TIPODOC+Documentoscabcli.C_ARMAZEM+Documentoscabcli.C_COD_SER+Documentoscabcli.C_NUMDOC, lcP, lcU) ;
> LEFT OUTER JOIN jbfic!documentos ;
> LEFT OUTER JOIN jbfic!clientes ;
> ON Documentoscabcli.c_tipodoc = Documentos.c_codigo ;
> ON Documentoscabcli.c_codcli = clientes.c_codigo ;
> ORDER BY Documentoscabcli.c_tipodoc, Documentoscabcli.c_armazem,;
> Documentoscabcli.c_cod_ser, Documentoscabcli.c_numdoc;
> into cursor fact
>
>Error: SQL: Column 'c_tipodoc' is not found, Why?
>
>Thank's in advance,
>
>João Batista
Rick Borup, MCSD

recursion (rE-kur'-shun) n.
  see recursion.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform