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:
| IDPessoa | Nome |
| 1 | João |
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...
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...
Considering the two forms of joining tables with a join (any):
SELECT Tabela.A, Tabela.B, Tabela2.C
LEFT JOIN Tabela2 ON Tabela.Id = Tabela2.TabelaId
And a union using from
SELECT Tabela.A, Tabela.B, Tabela2.C...
I have the following tables:
id | usuario | pnome | snome | foto
1 | Igor | Igor | Souza | perfil.png
2 | Alex | Alex | Khal | foto.jpg
3 | Maria | Maria | Silva | foto.png
id | amigo1 | amigo2 | e...
Is there a difference if I use:
from a left join b on a.id = b.id and b.id2=1
from a left join b on a.id = b.id
The first SQL returned me super fast, the second one did...
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,
FROM PEDIDO AS P,
(SELECT @ROW_NUMBER:=0) AS T
LEFT JOIN PEDIDOPRODUTO AS PP ON...