Questions tagged [self-referencing-table]

Refers to database tables with a column that is a foreign key to another column within the same table.

131 questions
1
vote
2 answers

sorting Self-Referencing Relationship

Assume the following model. Note the self-referencing relationship "parent". public class Category { public virtual long Id { get; set; } public virtual string Name { get; set; } public virtual Category Parent { get;…
1
vote
1 answer

How to delete on cascade a self reference relationship?

I have a table that has a autoreference relationship, like that: TableA(IDTableA, IDTableARoot,...) and I have this instead of delete trigger to delete: Delete from TableA where IDTableARoot IN(select deleted.IDTableA from deleted) Delete from…
Álvaro García
  • 18,114
  • 30
  • 102
  • 193
1
vote
2 answers

MySQL create a nullable foreign key that refers to the id field on the same table

Iam trying to make the "in_reply_to" field in the Post table a nullable foreign key that refers to the id field on the same table. Basically so if this field is null, then the post is not a reply to another post – if it is non-null then the post is…
1
vote
2 answers

d3.js Zoomable Sunburst visualization from self-referencing CSV input

I'm a newbie at d3.js and need help to adapt Zoomable Sunburst to make it work with self-referencing CSV data. Sample lines from the input CSV: id,parentId,name,size ROOT,NULL,Root, RE,ROOT,General > Revenue Expenditure, RE11,RE,Main supervision…
Nikhil VJ
  • 5,630
  • 7
  • 34
  • 55
1
vote
1 answer

SQL Server history tracking of a table with multiple same referencing column

In my database design, I'm tracking history with triggers. First of all, I have a base table Goods with the following columns: Tablename: Goods COLUMN1PK: GoodID COLUMN2: ArticleCode COLUMN3: Amount I want to track all operations made on the goods,…
1
vote
1 answer

Load a dimension table with a self-referencing foreign key

I'm looking to load a dimension table that will contain a self-referencing key, and I want to understand what the most efficient / effective method would be. Here's my setup: I have a Message table in my Staging environment that contains two keys,…
AHiggins
  • 7,029
  • 6
  • 36
  • 54
1
vote
1 answer

UpdateGraph with self referencing entity

I'm using GraphDiff with EF to update state of disconnected objects acquired from a REST Service. It's working rather well from now but I got a problem with self referencing entities. Entities : public class Foo { [Key] public int Id { get;…
Florian F.
  • 4,700
  • 26
  • 50
1
vote
1 answer

EF 6 Code First Many to many With Payload and self referencing many to many

I Have the problem where i have a many to many relationship and on one of the tables there will be a self referencing many to many. So basically a school have zero or many groups and many groups can have 0 or many schools. The groups table will…
1
vote
1 answer

Laravel - query self referencing table

I have a self referencing table with news and their respective translations as childs. What I'm looking to do is to query the language of the translation for each of the parent news to display in my index news page. In the index news page i have a…
Rui Silva
  • 99
  • 4
  • 12
1
vote
1 answer

Triple self reference?

Im not sure if is correct to have 3 self-references or if there is some othe way to confront this scenario. I have a table/entity "Animal" (with all kind of basic fields like id, name, description...) and i want to represent that a specific animal…
1
vote
1 answer

Entity Framework Code First Repository Pattern with Self Referencing Entity

I'm trying to implement the Repository/Unit-of-Work pattern for EF5 on .NET 4.5 as described here:…
1
vote
1 answer

Preventing user from adding a row that has more space than the alotted space, in a self-referencing table

I have a problem in a hierarchical query. I have a self-referencing table like this: id parent_id name size ----------------------------------------- 1 null Ship1 50 2 1 cabin1 10 3 1 …
0
votes
1 answer

Hide parent column in Telerik NestedHierarchy

I have a grid similar to the below one, mine has a few more data columns. I would like to hide ID and ParentID columns. But if I hide ID, Expand/Collapse functionality ceases to exist. All rows are displayed as in a normal table. How do I achieve…
Null Head
  • 2,877
  • 13
  • 61
  • 83
0
votes
0 answers

How to display data in Power BI as a hierarchy when the data has multiple nested self referential relationships

(edited, I solved problem so wanted to tell others how) Problem: Say you have: Item A. It can contain List of Item B, Item C, Item D. Each of these items also have a list of items themselves. Example, Item B has Item E, Item F. This can continue for…
0
votes
0 answers

Self-referencing table overwriting formulas: Power Query

Data Flow - > Sheet Development Image: enter image description here Partial Sheet image: enter image description here I have been able to make two sets of self referencing sheets. One works and the other does not. For the one that works: I have no…
1 2 3
8 9