Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

one to many join on two fields vfp

Posted on 2014-03-26
2
Medium Priority
?
760 Views
Last Modified: 2014-03-26
Hi:
I am trying to compose a form which  displays deliveries made to a range of customers on a given day by a given wagon. Two tables: 'wagons' comprises wagons and the date on which they deliver; and 'customers' comprises customers, wagon, and date.
They should therefore join at wagon AND date. However vfp will not let me create more than one join in the data environment. Before I write in a field that concatanates the wagon and date in each table then singly joins this new field, I thought I should ask an expert.....
Thanks!
0
Comment
Question by:ClaytonGlass
2 Comments
 
LVL 43

Accepted Solution

by:
pcelba earned 1000 total points
ID: 39955381
There are no joins but relations in VFP data environment. And relation cannot join two tables based on two different columns because it uses one index only.

So your options are
1) Concatenated column
2) No data environment but SQL query with your join:

SELECT c.* FROM Customers c
  INNER JOIN wagons w ON w.wagonID = c.wagonID AND w.date = c.date

3) You could also create a view from above SQL command and add this view into the data environment. It requires database container, e.g. :

CREATE DATABASE custwag
ADD TABLE customers
ADD TABLE wagons
CREATE SQL VIEW cwjoin AS SELECT c.* FROM Customers c INNER JOIN wagons w ON w.wagonID = c.wagonID AND w.date = c.date

The concatenated column provides the fastest response time because such column requires just one index for optimization.
0
 

Author Closing Comment

by:ClaytonGlass
ID: 39955385
Comprehensive as usual, thank you very much pcelba!
Gone for concatanated column.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question