Questions tagged [full-outer-join]

A full outer join combines the effect of applying both left and right outer joins.

Conceptually, a full outer join combines the effect of applying both left and right outer joins. Where records in the FULL OUTER JOINed tables do not match, the result set will have NULL values for every column of the table that lacks a matching row. For those records that do match, a single row will be produced in the result set (containing fields populated from both tables).

279 questions
1
vote
3 answers

Merge duplicate rows and create multiple columns based on data from one column

I am trying to merge a list of accounts from different sources and identify which account codes are set up identically across all sources. Here is the code: SELECT Distinct a.MainCode, a.Type, a.Group, a.InternalCode FROM…
1
vote
2 answers

How to JOIN on columns with same name?

I have tables T1 and T2. Both have columns ID, X and Y. In addition, T1 has another column Z and T2 has another column A. ID is primary key. X is calculated from ID (so if ID matches, also X matches). Column Y exists in both tables but content is…
JoKing
  • 430
  • 3
  • 11
1
vote
2 answers

Union of two tables with information of the origin of each row

suppose I have two tables A and B, both with only 1 column name. Some rows appear in both tables while some are exclusive to one table. I want to union these two tables together into a table C that has 3 columns name, is_in_A and is_in_B. For a row…
Urquhart
  • 129
  • 10
1
vote
2 answers

EF select many doesn't retrieve record which has no relation

I have two tables, for example, Student and Grade. Those two tables have a relationship with many-to-many, so the table is StudentGrade. By using the .SelectMany query, I can retrieve all records which have a relation. For example, var myResult =…
Steven Sann
  • 478
  • 1
  • 7
  • 27
1
vote
2 answers

Combining values from multiple tables using join clause with multiple ON

I want to combine all the related data using LEFT JOIN clause but if one of tables has no matched record from other table it will not show up. Can you check my queries it seems that there is missing or totally messed up. Here's my…
Thirdy Leon
  • 59
  • 1
  • 7
1
vote
2 answers

SQL Check if two columns from two tables are completely disjoint

I have two tables CREATE TABLE A ID INT PRIMARY KEY .... CREATE TABLE B ID INT PRIMARY KEY .... How do I check if A.ID and B.ID are disjoint using postgres. Disjoint meaning there is no value in B.ID that exists in A.ID…
Mistakamikaze
  • 446
  • 3
  • 19
1
vote
1 answer

Aggregating Amounts from Different Tables

I have a table t1 like this: store_id industry_id cust_id amount gender age 1 100 1000 1.00 M 20 2 100 1000 2.05 M 20 3 100 …
Caerus
  • 674
  • 1
  • 8
  • 19
1
vote
3 answers

merge tow querys in sql

I have a issuse in sql query. I have 2 select: The first one showing: columnA|columnB A |2 B |3 D |5 The other one showing: columnA|columnC A |1 B |5 C |7 I'm tying to merge this tow query, this is my…
bfs
  • 65
  • 1
  • 7
1
vote
1 answer

How to JOIN and get data from either table based on specific logics?

Let's say I have 2 tables as shown below: Table 1: Table 2: I want to join the 2 tables together so that the output table will have a "date" column, a "hrs_billed_v1" column from table1, and a "hrs_billed_v2" column from table2. Sometimes a date…
Stanleyrr
  • 858
  • 3
  • 12
  • 31
1
vote
2 answers

how can I shorten a postgresql query that uses same expression multiple times?

I would like to shorten this postgresql query so that I don't need to repeat "coalesce(gl.email, mc.email" several times... select r.*,l.*, coalesce(r.email, l.email) from righttable r full outer join lefttable l on r.email=l.email where…
GNG
  • 1,341
  • 2
  • 23
  • 50
1
vote
1 answer

Column match Spotfire pivot

I have a table of estimates by team and a table of spend by team. I made a pivot table using the estimates as the source table and created a column match by team so I could display estimate and spend in the same visualization. But there are teams in…
amidatti
  • 33
  • 5
1
vote
3 answers

FULL OUTER JOIN without any join conditions

I have two tables t1: +--------------+-------------+--------------+ | Product Name | Issue # | Risk Level | +--------------+-------------+--------------+ | Product1 | Incident#45 | Risk Level 2 | | Product2 | Incident#23 | Risk Level 3…
heyooo678
  • 81
  • 1
  • 8
1
vote
1 answer

How to perform full outer joins on multiple tables

I'm new to MySQL and trying to perform a full outer join operation on 3 tables: Student:- usn(Primary key) name plays :- usn(foreign key) sport_id(foreign key) sport :- sport_id(primary key) sport_name I want to get names of Students who…
1
vote
1 answer

full outer join behavior

HIVE SQL - I have 2 tables. survey and survey_comments and the structure is as shown below: create external table if not exists survey( id string, category_name string, subcategory_name string) STORED AS parquet; insert into survey(id,…
user1509593
  • 1,025
  • 1
  • 10
  • 20
1
vote
5 answers

Full outer join of two js arrays containing objects - joined array contains new property 'action' (add/remove/edit/same)

I have two arrays originalArray and modifiedArray which have objects with some properties; sys_id is the unique property: originalArray = [ { sys_id: 1234, type: 'XYZZ' }, { sys_id: 1235, type: 'ABCD' }, { sys_id: 1236, type: 'IJKL'…
Ryan Litwiller
  • 497
  • 5
  • 24