|
I am learning SQL and am trying to learn JOINs this week.
I have gotten to the level where I can do three table joins, similar to a lot of examples I've seen. I'm still trying to figure out the tiny details of how things work. All the examples I've seen...
Started by MedicineMan on
, 9 posts
by 9 people.
Answer Snippets (Read the full thread at stackoverflow):
The same general logic applies when selecting the join type when you have multiples as with single join the query easier for the....
It just depends on the data you are querying and what you are trying to follow .
An outer join in them.
|
|
What is the difference between left join and left outer join?
Started by KG Sosa on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Also note that the entire type....
As per the documentation: FROM (Transact-SQL) :
<join_type> ::= [ { INNER | { { LEFT | RIGHT | FULL } [ OUTER ] } } [ <join_hint> ] ] JOIN
The keyword OUTER.
They are equivalent.
Nothing.
|
|
Last week I was surprised to find out that sybase 12 doesn't support full outer joins. But it occurred to me that a full outer join should be the same as a left outer join unioned with a right outer join of the same sql. Can anybody think of a reason ...
Started by stu on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
You'd have to probably do a SELECT DISTINCT on the data set produced without the ALL , it will filter duplicates and... .
UNION -ing two OUTER JOIN statements should result in duplicate rows representing the data you'd get from an INNER JOIN .
|
Ask your Facebook Friends
|
I am trying to determine the performance of a piece of generated SQL that runs in SQL Server 2005.
It uses CROSS JOINS, but the conditionals tying the cross joined tables are in the where statement.
I previously thought that all cross joins that have ...
Started by jetimms on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Select companies.id, contacts.id from companies cross join contacts where contacts.companyid = companies.id select companies.id, contacts.id from....
And 'on' clauses during join operations, and i imagine the same is for cross joins.
|
|
Are there any performance drawbacks in SQL to joining a table on a char (or varchar) value, as opposed to say joining on an integer value?
Started by Aaron F. on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
An integer....
No, as long as the datatypes are the same between the tables that you join of the join column.
What can make a difference is:
- If datatypes in your join-condition than in the other column.
No there is not (in Oracle).
|
|
I've got the following request :
select * from tbA A, tbB B, tbC C, tbD D where A.ID=B.ID and B.ID2= C.ID2 and A.ID=D.ID and C.ID3=D.ID3 and B.ID4=D.ID4 and A.Foo='Foo'
I've heard several times that this join syntax is depreciated, and that I should use...
Started by Brann on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
I find join syntax much easier to understand
select * from tbA A inner join tbB B on a.id = b.id inner join tbC C on b.id2 = c.id2 inner join tbD D on a.id = d.id and c.id3 = d.id3 and b.id4 = d.id4 complicated join ....
|
|
Both these joins will give me the same results:
SELECT * FROM table JOIN otherTable ON table.ID = otherTable.FK
vs
SELECT * FROM table INNER JOIN otherTable ON table.ID = otherTable.FK
Is there any difference between the statements in performance or otherwise...
Started by driis on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
However for some reason I always use "OUTER" as in LEFT OUTER JOIN and never....
LEFT keyword that makes the JOIN an "OUTER" JOIN.
JOIN can be a bit more clear to read, especially if your query has other join types (e.g.
|
|
The effect of issuing an inner join is the same as stating a cross join with the join condition in the WHERE-clause. I noticed that many people in my company use cross joins, where I would use inner joins. I didn't notice any significant performance gain...
Started by soulmerge on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
There is no difference other than the inner join is a lot clearer because it defines the join, leaving....
I use the INNER JOIN syntax mainly because it's a lot clearer.
Possibly MySQL will use the same execution plan in both cases .
|
|
I have two tables:
Patient
pkPatientId FirstName Surname PatientStatus
pkPatientStatusId fkPatientId StatusCode StartDate EndDate Patient -> PatientStatus is a one to many relationship.
I am wondering if its possible in SQL to do a join which returns...
Answer Snippets (Read the full thread at stackoverflow):
BY ps.fkPatientId, ps.StartDate) as rownumber FROM Patient p INNER JOIN PatientStatus ps, ps.StatusCode, ps.StartDate, ps.EndDate FROM Patient p INNER JOIN PatientStatus ps ON p.pkPatientId, ps.StartDate, ps.EndDate FROM Patient p INNER....
|
|
I need to do a LINQ2DataSet query that does a join on more than one field (as
var result = from x in entity join y in entity2 on x.field1 = y.field1 and x.field2 = y.field2
I have yet found a suitable solution (I can add the extra constraints to a where...
Started by johnc on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Other types of joins can be constructed using other operators....
Var result = from x in entity join y in entity2 on new { x.field1, x.field2 } equals new { y.field1, y.field2 }
Using the join operator you can only perform equijoins.
|