Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

one to many join on two fields vfp

Posted on 2014-03-26
2
Medium Priority
?
742 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

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…
What we learned in Webroot's webinar on multi-vector protection.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

722 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