self-join Questions

3

Solved

I've got two tables in MS Access that keep track of class facilitators and the classes they facilitate. The two tables are structured as follows: tbl_facilitators facilID -> a unique autonumbe...
Osborn asked 29/12, 2014 at 1:2

1

I would like to create a structure of Users having many friends, also of class User: class User < ActiveRecord::Base has_and_belongs_to_many :friends, class_name: "User" end I do not need an...
Shed asked 4/11, 2013 at 15:17

2

Solved

I'm trying to get the top row by a group of three variables using a data.table. I have a working solution: col1 <- c(1,1,1,1,2,2,2,2,3,3,3,3) col2 <- c(2000,2000,2001,2001,2000,2000,2001,20...
Venita asked 2/4, 2013 at 23:9

2

Solved

I have a table instructors with the following strcture/data: ----------------- |id | name | ----------------- |1 | saad | |2 | imran | ----------------- I want to do a join with the same table w...
Brander asked 15/3, 2013 at 17:44

4

Solved

I'm trying to find duplicate rows based on mixed columns. This is an example of what I have: CREATE TABLE Test ( id INT PRIMARY KEY, test1 varchar(124), test2 varchar(124) ) INSERT INTO TEST (...
Inshore asked 11/12, 2009 at 19:40

1

Solved

I have a query requirement from ----. Trying to solve it with CONNECT BY, but can't seem to get the results I need. Table (simplified): create table CSS.USER_DESC ( USER_ID VARCHAR2(30) not n...
Schofield asked 14/10, 2012 at 20:44

2

Solved

Im trying to calculate the amount of money won by all the offspring of a male race horse (Sire) over a time period. Listed by the Sire with the most amount of money won. I run the query and get the...
Kendrickkendricks asked 2/10, 2012 at 17:11

3

Solved

Could anyone advice on how do I improve the performance of the following query. Note, the problem seems to be caused by where clause. Data (table contains a huge set of rows - 500K+, the set of pa...
Manouch asked 11/9, 2012 at 22:8

2

Solved

It is common task to make some evaluation on pairs of items: Examples: de-duplication, collaborative filtering, similar items etc This is basically self-join or cross-product with the same source o...
Hoarfrost asked 16/6, 2012 at 19:33

3

Solved

I have this data in a table, for instance, id name parent parent_id 1 add self 100 2 manage null 100 3 add 10 200 4 manage null 200 5 add 20 300 6 manage null 300 How can I left join or inner jo...
Vogeley asked 22/3, 2012 at 15:4

1

Solved

I'm using EclipseLink 2.3.1 to model self referencing table with JPA 2. I get weird warning from EclipseLink when I create the EntityManager. [EL Warning]: 2011-11-27 14:28:00.91--ServerSession(85...
Farce asked 27/11, 2011 at 12:52

1

Solved

Possible Duplicate: combinations (not permutations) from cross join in sql I've currently got a table with the following records: A1 A2 A3 B1 B2 C1 C2 Where the same letter denotes...
Goforth asked 17/9, 2011 at 6:40

1

Solved

If I have a table that I'd like to cross join to itself, how can I remove the duplicate rows? Or to put it another way, how can I do a "order doesn't matter" cross join? So for example, if I have ...
Thisbe asked 18/8, 2011 at 18:48

4

Solved

I am trying to implement multiple relations between records of the same model via self-joins (based on @Shtééf's answer). I have the following models create_table :relations, force: true do |t| t...
Despoliation asked 14/6, 2011 at 22:51

1

Solved

I have a User that can have collection of users he likes... Another user can have collection of users he likes.... If User A likes User B and if User B likes User A, then they get to hang out. I ...

1

Solved

Given the following tables: Student +----+-------+ | id | Name | +----+-------+ | 1 | Chris | | 2 | Joe | | 3 | Jack | +----+-------+ Enrollment +---------------+------------+-----------+-----...
Biblicist asked 29/4, 2011 at 0:6

5

What I'm doing I am creating an SQL table that will provide the back-end storage mechanism for complex-typed objects. I am trying to determine how to accomplish this with the best performance. I n...
Homebrew asked 23/2, 2011 at 14:13

1

Solved

So, I'm working on an app where I want to users to be able to group objects in "folders". Basically: User has_many :foos Foos don't have to be in a folder, but they can be. In that case: Folder ...
Urgency asked 24/2, 2011 at 20:12

1

Solved

Class members holds members and within that class is a List<Sessions>. The members I have in a List also. I have 2 members and each member has a number of sessions. I wish to only return each...
Saponify asked 17/2, 2011 at 9:14

2

Solved

I have an Entity model and I want to display connections between the Entities. ie, Entity 1 is connected to Entity 2. My thinking, right now, is to create a join model between the two called Conne...
Tautog asked 18/1, 2011 at 18:1

2

Solved

I have an ActiveRecord called Name which contains names in various Languages. class Name < ActiveRecord::Base belongs_to :language class Language < ActiveRecord::Base has_many :names Fi...
Impatience asked 4/9, 2010 at 11:15

5

Solved

What is self join and when would you use it? I don't understand self joins so a layman explanation with an example would be great.
Ananna asked 29/7, 2010 at 11:35

1

Solved

I have the following table: myTable: +----+----------+ | id | parentID | +----+----------+ | 1 | null | | 2 | 1 | | 3 | 1 | | 4 | 2 | | 5 | 4 | ----------------- i would like to get all rows tra...
Altdorf asked 18/7, 2010 at 15:36

2

Solved

I have a table like Employee ================== name salary ================== a 10000 b 20000 c 5000 d 40000 i want to get all the employee whose salary is greater than A's salary. I don't want...
Munich asked 14/6, 2010 at 5:29

1

Solved

I have an existing InnoDB table which already has foreign keys pointing to different tables. But when I try to create a foreign key pointing to the Primary index, I get an error (check data type)....
Chlamydospore asked 23/3, 2009 at 20:9

© 2022 - 2024 — McMap. All rights reserved.