Results 1 to 5 of 5
  1. #1
    velvettiger is offline Novice
    Windows XP Access 2000
    Join Date
    Mar 2010
    Posts
    5

    Query not returning all of the results

    Hi Guys,



    I was given a list which contain a list of student's firstname, lastname, street line 1, street line 2, street line 3 and country.This list has in 400 unique students names.The name of the list is called GR_list.

    I need to add the student's telephone numbers. These numbers are found in a table called student_summary. The student_summary list contains Id, firstname, lastname, street line 1, street line 2, street line 3,telephone numbers etc. This table has in thousands of rows.



    The first thing i did was import the list in access and then the following code was written

    Code:
    select  distinct s.ID,g.firstname, g.lastname, g.streetline1, g.streetline2, g.streetline3 g.country,s.telephone
    
    from GR_list g inner join student_summary s  on  (g.firstname= s.firstname) and (g.lastname=s.lastname) and (g.streetline1=s.streetline1) and (g.streetline2=s.streetline2) and (g.streetline3=s.streetline3) and (g.country=s.country)
    When I checked the results only 40 out of the 400 person were returned. And all 400 person are in the list. Could any one tell me why this is?

    Thanks
    Last edited by velvettiger; 03-11-2010 at 07:10 AM.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    First off I noticed this:

    ...g.streetline=s.streetline3...

    With joins on all those fields, the data in each field in the two tables would have to match exactly. Does it?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    velvettiger is offline Novice
    Windows XP Access 2000
    Join Date
    Mar 2010
    Posts
    5
    Quote Originally Posted by pbaldy View Post
    First off I noticed this:

    ...g.streetline=s.streetline3...

    With joins on all those fields, the data in each field in the two tables would have to match exactly. Does it?
    yes it does match exactly but also that line is suppose to be g.streetline3=s.streetline3.I know for sure that this query should returning more than 40.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You're saying the query has the 3 in the first one? If so, I would examine a record that you think should be included and check each field in each table. From Access's perspective, these don't match:

    123 Main St
    123 Main Street

    I suspect you'll find that something in one of the fields is different than the corresponding field in the other table. If not, can you post the db?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    velvettiger is offline Novice
    Windows XP Access 2000
    Join Date
    Mar 2010
    Posts
    5
    Hi all,

    I checked the file and all of the addresses that I checked so far matches the list provided to me. Does the code look right though?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Returning correct rows in a join/nested query
    By goneaccessing in forum Queries
    Replies: 5
    Last Post: 03-03-2010, 12:21 PM
  2. Query results order
    By Costa in forum Queries
    Replies: 6
    Last Post: 02-24-2010, 06:07 AM
  3. Weird Query results
    By UCBFireCenter in forum Queries
    Replies: 0
    Last Post: 10-06-2009, 03:38 PM
  4. DMax returning wrong value
    By nedbenj in forum Access
    Replies: 7
    Last Post: 10-24-2007, 10:30 AM
  5. Calling a function and returning a value
    By 3dmgirl in forum Programming
    Replies: 0
    Last Post: 04-23-2007, 02:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums