Skip to main content

Questions tagged [self-join]

1 vote
1 answer
250 views

I'm having trouble with a self-referencing foreign key in SQLite. I've created a table to store employee details, where each employee can have a manager who is also an employee. Here's the table ...
reubenjohn's user avatar
1 vote
1 answer
139 views

Consider: CREATE TABLE object ( id integer NOT NULL DEFAULT nextval('object_seq'), ..., CONSTRAINT object_pk PRIMARY KEY (id) ); CREATE TABLE pairing ( object1 integer NOT ...
Some_user's user avatar
0 votes
0 answers
762 views

TL;DR, I'll post back later with more info including table, view, and index definitions; before/after results; and query plans to help to answer this question. I'm trying to use a self-join to a view ...
mastaofdisastax's user avatar
0 votes
1 answer
706 views

I've the following simplified table with ~50M rows. table sample ( id uuid not null primary key, measured_date timestamp with time zone not null, segment_id uuid not null, activity_id ...
Cowabunga's user avatar
  • 145
0 votes
2 answers
162 views

-- The CTE1 is just to create columns that dictate the bound of what is considered the same entry -- Also I do a dense rank by ACT_TIME, and a PARITION BY on ID1, ID2 -- so all ID1/ID2 combos are ...
mike_gundy123's user avatar
2 votes
0 answers
926 views

Working with Microsoft SQL Server 2017 (RTM-GDR) (KB4505224) - 14.0.2027.2 (X64) We have a single table, which is planned to contain about 1.5 - 2, maybe max 3 million records at a time. Records will ...
Gábor Major's user avatar
0 votes
0 answers
25 views

We have a new sector of our company that is being put into our employee record feed. However this sector is listed as contractors as there are still parts of the sector that need access to systems ...
LOSTinDB's user avatar
  • 551
0 votes
2 answers
146 views

I ran into the following SQL code which (successfully) outputs a list of parents and the age of their youngest child: SELECT parents.name AS name, MIN(children.age) AS age FROM people children INNER ...
Friedman's user avatar
  • 103

15 30 50 per page