Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need ODBC Valid SQL syntax
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00563510
Message ID:
00563709
Views:
18
>>So now the ODBC problem. I need the above to be translated to an ODBC recognized statement that will give me all Parent records even when the parent has no children. So I need to do one of those great Joins, the problem is the ODBC syntax I have tried does not work. Can someone help here? Remember I still need the child and the Priority also linked through the child. TIA
>
>If you have Access available you could use the query wizard to produce the SQL for you, and then paste that to your SPT or other code. For example, the wizard generated this query out of the Nortwhind DB which has the same relationships as your example above:
>
SELECT DISTINCTROW Orders.OrderID, Orders.OrderDate,
>[Order Details].Quantity, Products.ProductName, Customers.CompanyName
>FROM Products INNER JOIN ((Customers INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID)
>INNER JOIN [Order Details] ON Orders.OrderID = [Order Details].OrderID) ON Products.ProductID = [Order Details].ProductID;
>Although if you want all parent records you would use an OUTER JOIN between Parent and child. It's kind of convoluted, but could get you started if you are not familiar with the Access SQL syntax.
>HTH


Access Query wizard is about as useless as VFP's when it comes to complex queries. Your example does not follow my request in that there are more than 1 relationship to maintain. The from has 4 tables involved. I have been able to get an outer join to work on one parent to one child, but ODBC seems to puke on syntax when trying to get the other tables involved in the query. Take a look at my example and see the other relationships that need to be part of the query when a join is to be done.
Bret Hobbs

"We'd have been called juvenile delinquents only our neighborhood couldn't afford a sociologist." Bob Hope
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform