Results 1 to 2 of 2

Thread: SQL Statement - Inner Join problems

  1. #1

    Thread Starter
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188

    Angry SQL Statement - Inner Join problems

    Hey All

    Can anyone tell me whats wrong with this:

    strSQL = "SELECT tbl_History.*, Employees.*, tbl_Vehicles.* FROM tbl_History INNER JOIN Employees ON (tbl_History.EID = Employees.Employee_ID) INNER JOIN tbl_Vehicles ON (tbl_history.VID = tbl_Vehicles.Vehicle) WHERE tbl_History.EID = " & eid & ""

    It returns no records when there is a record it should be returning.

    I have a feelign it's because of the WHERE statement.
    What i want it to be doing is Joining the 3 tables.
    Showing records that match the EID from the History table.

    ideas
    cheers
    b

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343
    Hi,

    You are definately sure that there are matching records in all tables?

    Try taking out the where clause and see whether it returns the correct results, then see whether id you are sending matches correctly.

    Last try would be to use left joins...


    Vince

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

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