Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Frustration: Add same table twice in a view joined on 2
Message
From
22/04/2003 14:19:20
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00780110
Message ID:
00780260
Views:
11
>Hi all
>
>I have a view lv_tInquiry. All fields updatable.
> Add Table mAccounts, Inner Join tInquiry.iPartyID = mAccounts.iID
>
>This in itself will work. Now...
>
>Again Add Table mAccounts, Inner Join tInquiry.iAgentID = mAccounts_a.iID
>
>This view though when modifying does not have any problem. But if you save it and want to reopen this view it wont open giving an error SQL: Column 'iAgentID' is not found.
>
>I tried opening this view in ViewEditor I get the same messge with error no. 1806. The following is the SQL generate for this view:
>
>SELECT TINQUIRY.*, ;
>		MACCOUNTS.CNAME, ;
>		MACCOUNTS.CCITY, ;
>		MACCOUNTS_A.CNAME, ;
>		MACCOUNTS_A.CCITY ;
>	FROM VSO3!TINQUIRY INNER ;
>		JOIN VSO3!MACCOUNTS INNER ;
>		JOIN VSO3!MACCOUNTS MACCOUNTS_A ;
>				ON TINQUIRY.IAGENTID = MACCOUNTS_A.IID ;
>				ON TINQUIRY.IPARTYID = MACCOUNTS.IID ;
>	ORDER BY TINQUIRY.DDT, TINQUIRY.CBK, TINQUIRY.INO
>
>
>I have tried Left Outer Join and same results. Right Outer Join and Full Join wont work in my case atleast.
>
>Please help. This is just the tip of the ice-burg where I want to call the same master table twice. I may also have to call, if not the same master, other master(s) in the view also.

My first bit of advice would have been 'Ensure the table being joined twice has two aliases', but the SQL appears to have that. So, I've only got two SWAGs left: Ensure that the fieldnames in the result set have unique names, and try rewriting the SQL in sequential order, it might make more sense.

Chris.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform