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
1 answer

EF4.1 and Left Outer Join to find nulls?

I have two tables, Address & People. People has FK to Address. I'm trying to find addresses where there are no people: select id from Address a left outer join person p on p.address_id = a.id where p.address_id is null Is this possible using LINQ…
chris
  • 36,094
  • 53
  • 157
  • 237
0
votes
2 answers

MySQL Translate Oracle Pl/SQL (+) to MySQL

I am trying to do a query with an outer join, and I've always used Oracle Pl/SQL in the past, but am now trying to learn MySQL. I'm trying to join 3 tables, USERS, USER_TYPE, and GRADE. The USERS table contains column, USER_TYPE_ID, which is a…
Ryan
  • 617
  • 2
  • 7
  • 16
0
votes
1 answer

left outer join in 3 tables

I hv 3 tables shop floor and owner shop is parent table and other 2 are child tables SHOP s_id, floor_id,s_owner,s_remarks 1,2,1,big shop 2,2,3,near bank 3,1,2,corner 4,7,7,FAKE FLOOR AND OWNER OWNERS o_id, o_name,…
Fakhr Alam
  • 203
  • 1
  • 5
  • 12
0
votes
1 answer

Access 2010: the field is too small to accept the amount of data you attempted to add WITHOUT DISTINCT

I know there are a couple of questions regarding this Access Error message, but they are not related in that my query doesn't use the DISTINCT Key word. I have two similar queries, one contains credits and the other contains debits. They are…
ajon
  • 7,868
  • 11
  • 48
  • 86
0
votes
2 answers

SQL: Join Parent - Child tables

I'm building a simple review website application and need some help with SQL Query. There are 3 tables (Topics, Comments, Users). I need a SQL query to select the data from all 3 tables. The 'Topics' table is the parent and the 'Comments' table…
pray4Mojo
  • 53
  • 2
  • 7
0
votes
3 answers

Select from two outer joined tables where a possible null column

Question similar to this: select from two tables where linked column can be null column1tab1 column2tab1 order_number product amount xx yy 123 p1 2 xx yy 456 p3 4 xx yy …
txchou
  • 647
  • 1
  • 6
  • 15
0
votes
1 answer

ORA-00932 when using OUTER join on a view

My simplified query is as follows: INSERT INTO table1 (acct_no, name, description) SELECT a.acct_no, b.name, TO_LOB(c.description) FROM tableA a, viewB b, tableC c WHERE a.person_id = b.person_id(+) AND a.person_id = c.person_id; Notes: I am…
AKS
  • 81
  • 6
0
votes
2 answers

Access 2007 SQL - Mixing Left Join and Inner Join

It's really hard for me to sort this thing out. I've tried every possible combinations on the FROM part but I can't seem to get it. I've tried comma, mixing inner join & left join then this. The [give some date pls] is a parameter prompt (for MS…
jestrange
  • 271
  • 3
  • 15
0
votes
1 answer

Join tables multiple times on different rows in one result set

So I've got 2 tables (simplified below) members documents ------------ ------------------ id | name | registered id | member_id | type | expiry ---------------------- ------------------------------ 1 |…
Andrew Martin
  • 55
  • 2
  • 7
0
votes
1 answer

Retrieve columns from the same table with the same foreign keys but different values

This is a quite delicate question, but I'll give my best to make it clear: I have a table countrynames with 3 columns: iso, lang, name. The main spelling for these is english, for example: +-----+------+-----------------------------+ | iso | lang |…
Dragos
  • 72
  • 2
  • 7
0
votes
2 answers

SQL Distinctive Join

I'm trying to join a distinct field on another field. Example: There are multiple rows in tbl.Class classified under column.Teacher that have the same value. I want to join just one DISTINCT value from column.Teacher to column.Teacher_Course in…
0
votes
1 answer

Left outer join in Linq To Entities (The entity or complex type cannot be constructed in a LINQ to Entities query.)

I have two class that map two tables of my database: public class Product { public int Id { get; set; } public string Token { get; set; } public string Name { get; set; } public decimal Value { get; set; } } public class Ticket { …
Vinicius Ottoni
  • 4,631
  • 9
  • 42
  • 64
0
votes
2 answers

How to perform a OUTER JOIN on two complex SQL queries?

I have two relatively complex queries that I am trying to join together into one result set. Result set 1: SELECT sq.question_id, COUNT(ra.question_option_id) AS TotalAnswers FROM dbo.survey_question sq LEFT OUTER JOIN…
Darren
  • 793
  • 5
  • 17
  • 30
0
votes
2 answers

MySQL Joins - Placement of the ON clause

I recently tried to pull some results and was struggling to work out the correct query to do it. All the examples I have seen and even my MySQL book show joins as follows: SELECT * FROM table_1 LEFT JOIN table_2 LEFT OUTER JOIN table_3 LEFT JOIN…
Ashley Bye
  • 1,752
  • 2
  • 23
  • 40
-1
votes
2 answers

Outer Join in mYsql Qyery

I have folowing MYsql Query And Trying to right outer join but unable to understan how to do this here is query plase any one help select lp_des.lpname,today.cnt_veh_tdy,todate.cnt_veh_tdate from (select distinct…
Adeel Aslam
  • 1,285
  • 10
  • 36
  • 69