Jump to content
  • 0

Problem With Self Join View With 3 Tabels


peterhanse
 Share

Question

Good morning, i need some help with some views, 

 

I have 3 tabels

 

I need a view whit:

 

all horses (tabel2) (tabel3 empty)

all conections horses (tabel2) (tabel3)

 

tabel1 name:users

 

field: user_id(key)

 

tabel2 name:horse

 

field: horse_id (key)

field: user_id

 

 

Tabel3 name:conections 

 

field:conection_id(key)

field:horse_id

field:user_horseowner_id (user_id)

field:user_linked_id (user_id)

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hello peterhanse,

 

If I were in your shoes, I'd use four tables:

 

1. Users:

id

many fields - information.

 

2. Horses:

id

many fields - information.

 

3. Ownership:

id

link_to_horse

link_to_owner

 

4. Lnked_users

id

link_to_horse

link_to_user

 

Settings of the View:

Tables are used:

Users

Users_1 (the second time)

Horses

Ownership

Linked_users

 

Relationships:

Ownership.link_to_owner (include all records) = Users.Id (include only matching records)

Horses.id (include all records) = Ownership.link_to_horse (include only matching records)

Horses.id (include all records) = Lnked_users.link_to_horse (include only matching records)

Lnked_users.link_to_user (include all records) = Users_1.Id (include only matching records)

 

Is it the correct View?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...