General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
What is wrong in my sql statement
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only