Questions tagged [outer-join]

An outer join defines a relationship between two tables where all records from one or both tables are returned regardless of the existence of a matching key-field in the other table. A full outer join combines the results of both tables. A left or right join returns all the records from the first or second specified table, respectively. NULLS are filled in for matches on either side. A self-join compares a table to a copy of itself.

A full combines the results of both tables. A left or right returns all the records from the first or second specified table, respectively. NULLS are filled in for matches on either side. A compares a table to a copy of itself.

References

1671 questions
0
votes
2 answers

Selecting the latest entry from Table1 which isn't *later* than an entry from Table2

Suppose I have a table... Calibrations: Date CalibrationFactor and another table... Readings: Date Reading Readings are made regularly... calibrations (which don't alter subsequent readings, but just figure out how much the readings are off at…
Jemenake
  • 2,092
  • 1
  • 20
  • 16
0
votes
1 answer

MySQL: How to join when a particular type of record isn't in another table

My brain is turning to mush over this one, but I suspect there's an easy answer. I have a table of theatre shows and I also have a table of reviews of those shows. The reviews have a flag to signify whether the review is in-house or an audience…
PeteSE4
  • 309
  • 1
  • 4
  • 21
0
votes
2 answers

SQL Server outer join issue

I'm having a bit of trouble getting an outer join to work: I've had them work as I expected in MS Access in the past, but getting a similar thing happening in SQL Server is giving me issues. I have a table of scores that apply to each student…
Katstevens
  • 1,556
  • 13
  • 29
0
votes
1 answer

LEFT OUTER JOIN with an OR condition <- kills db server

In a nutshell.. SELECT * FROM tbl1 LEFT OUTER JOIN tbl2 ON tbl1.ID = tbl2.externalRefID WHERE tbl1.varref = '12345' OR tbl2.varref = '12345'; With any volume of data in these tables this query takes forever. Yet I need the second table outer…
markdrayton
  • 65
  • 1
  • 7
0
votes
6 answers

Is it possible to restrict the results of an outer join?

I've got a scenario where I need to do a join across three tables. table #1 is a list of users table #2 contains users who have trait A table #3 contains users who have trait B If I want to find all the users who have trait A or trait B (in one…
stu
  • 8,461
  • 18
  • 74
  • 112
0
votes
4 answers

need to join table on based of condition in mysql

I want to integrate like functionality in iOS/android app. I am developing service for that. My question is : I have table called songs in which I have song details **like** song song_id station_id song_file so on. I have second table called…
mayur bhagat
  • 209
  • 3
  • 12
0
votes
1 answer

Creating a function to implement full outer joins in Sybase

I have a long nested full outer join sequence I need to implement in Sybase Adaptive Server Enterprise. Is it possible to write a function for this? I want to simplify the code below: select t1.col_01, t1.col_02, TOT_Jan, TOT_Feb from (select…
0
votes
2 answers

Multiple left joins to single table

I have a whole bunch of tables: Table1: PersonID, A1, A2, A3, ... Table2: PersonID, B1, B2, B3, ... Table3: PersonID, C1, C2, C3, ... Table4: PersonID, D1, D2, D3, ... ... Table1 is special as it does in fact contain all individuals (names and…
mstobb
  • 5
  • 3
0
votes
4 answers

Accessing outer class from inner python

Consider this piece of code: class Page(object): def __init__(self, name, title): self.name = name self.title = title self.selected = False def select(self): <-- How can I make this method work? for Page in…
Barmaley
  • 1,232
  • 20
  • 27
0
votes
4 answers

How to left outer join from two tables to a third table

I've got three tables A B and C (the last is the result I want) A.id B.age C.id C.age result id age 1 5 1 5 1 5 2 6 2 0 null null 3 …
stu
  • 8,461
  • 18
  • 74
  • 112
0
votes
1 answer

How to count matches across two sets of data

I am using Micorosft SQL Server. I have two tables, t1 and t2, that each consist of the following set of variables: PatientID, AdmissionDate, DiagnosisCode. Note that multiple diagnoses within an admission are shown as multiple rows. Each table…
0
votes
1 answer

Use SUBSTR in HSQL left outer join clause

I need to perform the following query using HSQL (with ORACLE works fine): select t.name as sh_name, b.name as sh_bName from PERSON t left outer join TRANS tr on t.id=tr.tid left outer join AGREEM agr on…
Marius
  • 3,253
  • 5
  • 25
  • 29
0
votes
2 answers

How to insert display:inline into outer div

I have 4 analog clock widgets which Im trying to line up horizontally on my web page. I was told that I have to "insert a display:inline in the outer div of each clock." in order to get them line up horizontally but I have no idea how to do this…
0
votes
3 answers

Add multiple columns in FULL JOIN, assume empty row as zero

I run PostgreSQL and I have multiple (10+) tables with identical column names and formats and I would like to sum two of their columns. If a row is missing in one of the tables, I need it to be considered as 0 (zero). Two-table…
TimY
  • 5,256
  • 5
  • 44
  • 57
0
votes
2 answers

Multiple Joins between multiple tables

I am building a Time off requests tool for work. I have 3 tables: REQUESTS, COVERED, and MODID. REQUESTS Has the following fields: ID INT Auto_Increment not null Primary Key MODID VARCHAR(7) not null THE_DATE DATE not null THE_TIME VARCHAR(30) not…
Aaron Henderson
  • 193
  • 3
  • 14