Mike Yearwood
Toronto, Ontario, Canada
General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Hi Thomas
>Desired: Create a SQL statement using 6 tables to be used in a more complex report.
>
>
>Tried: SQL Pass through.
>Results: Only able to use one table.
>
>Scenario 1.
>
>Code:
>*Simplified.
>
>Load:
>
>STORE SQLSTRINGCONNECT('Driver={SQL SERVER};Server=N103;Database=Development;uid=User;pwd=User');
> TO tConnection
>IF tConnection < 0
> = MESSAGEBOX('Cannot make connection', 16, 'SQL Connect Error')
>ENDIF
>
>Thisform.pConnection = tConnection
>
>
>Method:
>
>*Simplified.
>*A filter is built called lcFilter
>
>thisform.grdData.recordsource = SPACE(0)
>
>tConnection = Thisform.pConnection
>
>SQLEXEC(tConnection, 'SELECT ReworkNumber, SupplierCode, SupplierName, ;
> PartNumber, PartName, Kanban, Problem, ;
> Model, DateCreated ;
> FROM Tally ;
> &lcFilter ORDER BY ReworkNumber DESC ', 'rvLineCall')
>
>*This works fine. It you precede more than one field name with the *table name it bombs.
>*If you try to use more than one table it bombs.
>*It works great for one table!
>
I use multi-table joins all the time. Your lcFilter would have to reference aliases inside the SQL. Example:
select oa.ord_id, it.itm_id from orders oa inner join items it on itm_ordid = oa.ord_id
If your lcFilter referenced Orders and Items, it would crash.
What does the SQL and lcFilter look like?
Previous
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