Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What is wrong in my sql statement
Message
From
15/11/2000 13:20:28
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
What is wrong in my sql statement
Miscellaneous
Thread ID:
00442223
Message ID:
00442223
Views:
45
When I have two Left outer join the sql statement does not work
here is the code I have used(When I remove depts table the code works)

**********************
procedure printrec
public lsqlhandle, lsqlstring, lsqlcursor, lsqlerror
lsqlhandle = sqlstringconnect("DSN=Visual FoxPro Database;UID=;PWD=;SourceDB=C:\tarun\basedata\Base1.dbc;SourceType=DBC;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;Null=Yes;Deleted=Yes;")
if (lsqlhandle <= 0)
= MESSAGEBOX('Cannot make connection', 16, 'SQL Connect Error')
return
endif
lsqlstring = " SELECT Purchase.*, Accmst.accname, Depts.deptname;
FROM purchase LEFT OUTER JOIN accmst;
LEFT OUTER JOIN depts ;
ON Purchase.department = Depts.deptno ;
ON Purchase.partycode = Accmst.acccd"



lsqlcursor = "purreg01"
lsqlerror = sqlexec(lsqlhandle,lsqlstring,lsqlcursor)
=sqldisconnect(lsqlhandle)
if (lsqlerror <= 0)
= MESSAGEBOX('Cannot Execute SQL Command', 16, 'SQL Connect Error')
return
endif
sele &lsqlcursor
repo form purreg01 to printer prompt preview
sele &lsqlcursor
use
Next
Reply
Map
View

Click here to load this message in the networking platform