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
4
votes
3 answers

FULL OUTER JOIN value condition

I need to add value condition to the FULL OUTER JOIN. I.e. I'm triyng to do this: SELECT * FROM Table1 FULL OUTER JOIN Table2 ON Table1.Field1 = Table2.Field1 AND Table2.Field2 > 5 But this script doesn't work. Actually it looks like the condition…
SergeyT
  • 349
  • 1
  • 7
  • 16
4
votes
1 answer

How to index views with left outer join in SQL Server

I have created a view which is using LEFT OUTER JOIN in SQL Server. I am unable to index the views because you cannot put an Index on a view with an OUTER JOIN. Any alternatives?
Ankit
  • 133
  • 4
  • 16
4
votes
2 answers

Flask-marshmallow dump of flask-sqlalchemy outer join returns empty

I have two tables, PackMatData and ColorData: class PackMatData(db.Model): id = db.Column(db.Integer, primary_key=True) unique_name = db.Column(db.String(20), index=True, unique=True) se_name = db.Column(db.String(20), index=True) …
4
votes
1 answer

How to do a write a JPQL query to find records not found in this join?

For the life of me, I can't figure out how to construct this JPA query. I need to find TransactionLogs which have not been transmitted under a given SyncSendingConfig, ordered by ID. Researching it on SO, I figure it should be possible in SQL to do…
Cuga
  • 17,668
  • 31
  • 111
  • 166
4
votes
0 answers

Nhibernate Query and OrderBy cause multiple join on the same tables

The two core entities in the model are: Account Registration Here is the fluentNH mapping between Account and Registration: .Override(m => { m.References(x => x.Registration).Cascade.All().Not.Nullable().Unique(); //…
vikram nayak
  • 591
  • 5
  • 14
4
votes
1 answer

Left Outer Join via Linq To Entities via Entity Framework with Where clause

I have read all the posts related to implementing the equivalent of a LEFT OUTER JOIN in Linq to Entities (.NET 3.5) when using the Entity Framework, but have yet to find a solution to the following problem. Given two tables, represented by the…
4
votes
0 answers

outerjoin MATLAB in python

I would like to have in python the same behavior as the MATLAB function outerjoin. I've been using pandas.merge, but the result is different in case of having NaNs. matlab t1 = table([24;25], [NaN;10], 'VariableNames',{'a50','a36'}); t2 =…
P. Ma
  • 51
  • 4
4
votes
3 answers

Show complement results from statement sql

I have a twiter-like web, where users follow another users, I need to show them suggestions to follow new people TABLE USERS user id_user A 1 B 2 C 3 D 4 E 5 F 6 TABLE COMMUNITY id_follower id_followed 3 …
masterhoo
  • 89
  • 8
4
votes
3 answers

End-of-window outer join with KafkaStreams

I have a Kafka topic where I expect messages with two different key types: old and new. i.e. "1-new", "1-old", "2-new", "2-old". Keys are unique, but some might be missing. Now using Kotlin and KafkaStreams API I can log those messages with have…
Nikolay Kuznetsov
  • 9,467
  • 12
  • 55
  • 101
4
votes
2 answers

Merge for all "occurrences" of a non-key variable

I have two datasets, and what I want may be loosely termed as "outer join on a non-key variable". Here are the datasets Dataset 1 oc oc2 state_id r_state A011 A01 1808 1.00 A011 A01 1810 0.50 A012 A01 1810 0.50 …
Gaurav Singhal
  • 998
  • 2
  • 10
  • 25
4
votes
2 answers

How to include zero-count results in query

I have these two tables: Operators: Id Nome --+---- 1 JDOE 2 RROE 3 MMOE Calls: Id CallDate OpId --+--------+---- 1 20161228 2 2 20161228 3 3 20161228 2 4 20161228 3 5 20170104 1 6 20170104 2 7 20170104 1 And…
VBobCat
  • 2,527
  • 4
  • 29
  • 56
4
votes
3 answers

Is there an efficient way to outer join several (more than 2) kafka topics?

I'd like to outer join several (typically 2-10) Kafka topics by key, ideally using the streaming API. All topics will have the same key and partitions. One way to do this join is to create a KStream for each topic and chain calls to…
Reinstate Monica
  • 2,420
  • 14
  • 23
4
votes
1 answer

Ordering rows by joined tables in postgres

I had difficulties to even come up with the correct question title. I'll take any advice to edit it. My problem: I have an app (job board) with two models: User, Job. User can have many jobs and jobs can be premium or free. Jobs can be expired or…
Lubomir Herko
  • 354
  • 3
  • 11
4
votes
1 answer

How to force outer join with .Include query Entity Framework 6

My data model is below. UserPhone is required but navigation property is optional as long as User's table could be empty: public class Request { [Key] public int Id {get;set;} [Required] public string UserPhone {get;set;} …
Mando
  • 11,414
  • 17
  • 86
  • 167
4
votes
2 answers

Unknown column '..' in 'field list' join

I made a simple query with join but get always this annoying error. The query: SELECT `verk.id`, `verk.date`, `verk.quant`, `verk.verid`, `verk.kunde`, `verk.gebracht`, `loginuser_aqa.name`, `loginuser_aqa.id` FROM `verk` FULL JOIN …
delato468
  • 474
  • 4
  • 18