[Solved] Can a table be related to itself?

Creating and using forms

[Solved] Can a table be related to itself?

Postby gkick » Sun Sep 15, 2019 7:49 am

Hi,

Not sure if what I want to do is possible, its kind of a table looking itself up.
The scenario is depicted in the screen dump below.

Main form listing Identities like credit cards, web logins etc, one record at a time. PK is iid auto
On the right a table control based on a query taking the iid from the identity table as well as the fields from a couple of reference tables.

The browsing works all fine, but I can not figure out how to modify the form to allow for additions of new records, getting integrity msg. All the properties are set to allow additions. I understand its not the 1 to 1 or 1 to many nor many to many, its more like the table having a relationship with itself.
Anyone can think of a work around?

Thks
Attachments
Captura2.JPG
Last edited by gkick on Sat Sep 21, 2019 8:10 am, edited 2 times in total.
Libre Office 6.2 on Windows 10 HSQL 2.5 backend
gkick
 
Posts: 250
Joined: Wed Aug 07, 2019 5:24 pm
Location: Chile

Re: Can a table be relted to itself?

Postby Villeroy » Sun Sep 15, 2019 8:41 am

Code: Select all   Expand viewCollapse view
SELECT "A".*, "B".* FROM "Table" AS "A" JOIN "Table" AS "B" ON "A"."X"="B"."Y"

compares 2 instances A and B of the same table.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 28431
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Can a table be related to itself?

Postby gkick » Mon Sep 16, 2019 5:09 am

Thanks Villeroy, if I use this as data source for the table control, will that then allow additions to the Identities form ?
Libre Office 6.2 on Windows 10 HSQL 2.5 backend
gkick
 
Posts: 250
Joined: Wed Aug 07, 2019 5:24 pm
Location: Chile

Re: Can a table be related to itself?

Postby Villeroy » Mon Sep 16, 2019 1:39 pm

I don't know. May be you need a one-table form and a subform with related records of the same table.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 28431
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany


Return to Forms

Who is online

Users browsing this forum: No registered users and 1 guest