Tom Knowlton
asked on
LEFT JOIN vs RIGHT JOIN ???
Someone please explain
LEFT JOIN
vs
RIGHT JOIN
Why do I care if something is LEFT JOINED vs RIGHT JOINED?
I need someone to put this in layman's terms, really dummy it up.
I am trying to progress beyond SELECT FROM WHERE which is about as advanced as I get in SQL knowledge right now.
Thanks,
Tom
LEFT JOIN
vs
RIGHT JOIN
Why do I care if something is LEFT JOINED vs RIGHT JOINED?
I need someone to put this in layman's terms, really dummy it up.
I am trying to progress beyond SELECT FROM WHERE which is about as advanced as I get in SQL knowledge right now.
Thanks,
Tom
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
i've been reading it 3.526 times now Nico,
i must admit, i s@ck at SQL...
;-) ;-) ;-) ;-) ;-) ;-) ;-) ;-) ;-) ;-)
i must admit, i s@ck at SQL...
;-) ;-) ;-) ;-) ;-) ;-) ;-) ;-) ;-) ;-)
Ricky, too much Hoegaarden causes reading loops.... ;-)
Nic;o)
Nic;o)
Public Sub Freetime()
Dim strSQL as String
Dim strBrand as String
Dim rst as DAO.Recordset
Dim dbs as DAO.Database
Select Case Today
Case Friday
strBrand = "Hoegaarden"
Case Saturday
strBrand = "KasteelBier"
Case Sunday
strBrand = "Jupiler"
End Select
strSQL = "Select Glas, Bottle From Bar where Brand = " & chr(34) & strBrand & chr(34) & ";"
set dbs = CurrentCafe
set rst = dbs.Openrecordset(strSQL)
rst.moveFirst
While dbs = open
rst.Edit
rst.Drink
rst.update
rst.Movenext
Wend
set rst = empty
dbs.close
set dbs = empty
msgbox "Time to go home", vbOkonly + vbInformation, "C ya tomorrow"
End Sub
Dim strSQL as String
Dim strBrand as String
Dim rst as DAO.Recordset
Dim dbs as DAO.Database
Select Case Today
Case Friday
strBrand = "Hoegaarden"
Case Saturday
strBrand = "KasteelBier"
Case Sunday
strBrand = "Jupiler"
End Select
strSQL = "Select Glas, Bottle From Bar where Brand = " & chr(34) & strBrand & chr(34) & ";"
set dbs = CurrentCafe
set rst = dbs.Openrecordset(strSQL)
rst.moveFirst
While dbs = open
rst.Edit
rst.Drink
rst.update
rst.Movenext
Wend
set rst = empty
dbs.close
set dbs = empty
msgbox "Time to go home", vbOkonly + vbInformation, "C ya tomorrow"
End Sub
SYNTAX-ERROR rst.Drink UNKNOWN PROPERTY ;-)
(Sorry for the interrupt knowlton)
Nic;o)
(Sorry for the interrupt knowlton)
Nic;o)
ASKER
Thanks everyone.
btw - while I was waiting for a reply I found a cool tutorial at:
http://www.w3schools.com/sql/sql_join.asp
btw - while I was waiting for a reply I found a cool tutorial at:
http://www.w3schools.com/sql/sql_join.asp
The direction you draw the line will influence the sequence of the "mandatory" tables mentioned in the pop-up and lead to a LEFT or RIGHT.
Effectively the "non-match" wizard delivers only half of the non-match, as having a right-join, the left-join gives also a "non-match" but then seen from the other table.
To get all non-matching records you need to have a right-join AND a left-join with in both the criteria that the non-mandatory table has nulls in it's unique key.
With a union of those two queries you get effectively what another SQL implementation would call a FULL OUTERJOIN.
Normally a JOIN gives automatically all matched, the LEFT "union" RIGHT gives the remaining set of rows.
Clear ?
No, read again and again and ....
Nic;o)