Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with a View
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00148071
Message ID:
00148125
Views:
17
>I have 4 tables that I am trying to work with in creating a view. I have a payment file that has and instructor # as a field that relates to the instructor table. The payment file also has an Account# field that relates to a Customer table. And finally since one customer can have multiple students there is a subacct field in the payment file.
>I need both the account# and subacct values to find a match in the student file.
>
>Anyway here is the code I am trying to use to create a view:
>
>
>CREATE VIEW v_payments as ;
>SELECT Payment.*, Instructor.*, Customer.*, Student.*;
> FROM  ls!payment LEFT OUTER JOIN ls!instructor;
>    LEFT OUTER JOIN ls!customer;
>    LEFT OUTER JOIN ls!student;
>   ON  Payment.pay_acct = Student.stu_acct and ;
>       Payment.pay_sub = Student.stu_sub ;
>   ON  Payment.pay_acct = Customer.cus_acct ;
>   ON  Payment.pay_inst = Instructor.ins_inst
>
>
>The join seems to be working for the instructor, but I get the same customer and student record for every payment record. Its not getting the correct Customer or Student record.
>
>I am really struggling with how to create this view.
>
>TIA
>
>Paul

You need to add a WHERE clause to finish this up.
Ken Sorce
Team RAD, Inc.
Rapid Application Developers
Ken@TeamRAD.com
www.teamrad.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform