Questions tagged as 'join'

4
answers

What is the difference between INNER JOIN and OUTER JOIN?

What is the difference between INNER JOIN and OUTER JOIN ? Can you give me some examples?     
asked by 19.02.2014 / 03:32
1
answer

Implications of using inner join and left join on the same select

I have some stored procedures in a SQL Server 2008 R2 database, these stored procedures have several joins , in some cases I used the < , inner join and left join , for example: Tabela Pessoa | IDPessoa | Nome | | 1 | João | |...
asked by 17.12.2014 / 00:55
1
answer

Doubt on using LEFT JOIN in mysql

I have the following problem: I have two tables. students and proof Students have 10 students evidence has 9 results (because one student was absent) The union of the tables occurs through the enrollment field. I want to merge the tw...
asked by 22.05.2016 / 17:12
1
answer

Problem with logic when using LEFT JOIN

In my system, there is a system of postings and another system of friendships. Here is the structure of the tables: posts : id | usuario | conteudo | data | hora Friendships : id | usuario1 | usuario2 | status And I'm us...
asked by 21.11.2015 / 16:50
2
answers

Difference between RIGHT JOIN and LEFT JOIN [duplicate]

I have a little knowledge on table relationships, I have read the answers to the question on #
asked by 27.08.2016 / 02:21
1
answer

Difference Between Using "FROM Table, Table2" X "Join Table ON Table2"

Considering the two forms of joining tables with a join (any): SELECT Tabela.A, Tabela.B, Tabela2.C FROM Tabela LEFT JOIN Tabela2 ON Tabela.Id = Tabela2.TabelaId And a union using from SELECT Tabela.A, Tabela.B, Tabela2.C...
asked by 06.04.2017 / 14:47
2
answers

Count friends in common using LEFT JOIN

I have the following tables: users : id | usuario | pnome | snome | foto 1 | Igor | Igor | Souza | perfil.png 2 | Alex | Alex | Khal | foto.jpg 3 | Maria | Maria | Silva | foto.png Friendships : id | amigo1 | amigo2 | e...
asked by 03.05.2016 / 18:05
2
answers

Condition in join or in where?

Is there a difference if I use: select * from a left join b on a.id = b.id and b.id2=1 where ... or select * from a left join b on a.id = b.id where b.id2=1 Sent on: Fri ? The first SQL returned me super fast, the second one did...
asked by 30.08.2016 / 13:52
3
answers

Error while joining with Laravel's Query Builder

I'm doing the following Join: public function getStockDanger() { $data = DB::table('product') ->join('stock', 'product.id', '=', 'stock.product_id') ->where('stock.stock', '<=', 0) ->get(); return v...
asked by 07.10.2016 / 19:44
1
answer

SELECT with sequential counter does not accept LEFT JOIN

Why does a SELECT return a sequence number does not work if it has LEFT JOIN ? SELECT @ROW_NUMBER:=@ROW_NUMBER+1 AS ROW_NUMBER, P.PEDIDOID FROM PEDIDO AS P, (SELECT @ROW_NUMBER:=0) AS T LEFT JOIN PEDIDOPRODUTO AS PP ON...
asked by 27.05.2015 / 00:11