Results 1 to 3 of 3

Thread: joins

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Seattle
    Posts
    954

    joins

    I have written a sql query that looks like the following but get an error saying that there us a syntax error in the join query. This is on Access 2000 using a vb front end..

    Select * from tblEmp, tblSenders LEFT OUTER JOIN tblSenders on tblEmp.Site = tblSenders.Site and tblEmp.Logon_ID = tblSenders.Logon_ID where tblEmp.Logon_ID = " & "'" & user & "'" & " and tblEmp.site =" & "'" & offnum & "'"

  2. #2
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    I see you've used " to enclose the string variables. Try using a ' instead.
    Also, I think the OUTER part of a LEFT JOIN is implied. Try doing LEFT JOIN instead of LEFT OUTER JOIN.
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  3. #3
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    I suppose I should just write it...

    Select * from tblEmp, tblSenders LEFT OUTER JOIN tblSenders on tblEmp.Site = tblSenders.Site and tblEmp.Logon_ID = tblSenders.Logon_ID where tblEmp.Logon_ID = " & "'" & user & "'" & " and tblEmp.site =" & "'" & offnum & "'"


    Oh, hang on, I think I know... (You've JOIN tblSenders to tblSenders??)

    Select * from tblEmp LEFT JOIN tblSenders on tblEmp.Site = tblSenders.Site and tblEmp.Logon_ID = tblSenders.Logon_ID where tblEmp.Logon_ID = '" & user & "' and tblEmp.site ='" & offnum & "'"
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width