A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Unable to bring back all results from table with query



 
 
Thread Tools Display Modes
  #1  
Old December 2nd, 2009, 03:13 PM posted to microsoft.public.access.queries
Karrot_Bex
external usenet poster
 
Posts: 3
Default Unable to bring back all results from table with query

For a uni assignment we have a designated query that we have to create.

But when I run the query, I get one result returned to me. I should have two
returned to me, as I have two records in the Problem table.

The SQL is:- SELECT Problem.[Problem Number], User.[User ID], User.[User
Name], User.[Job Title], User.Email, User.[Telephone No], Asset.[Asset Code
No], Problem.[Problem Description], Problem.[Current Activity Log],
Problem.[Solution Description]
FROM [User] INNER JOIN ((Asset INNER JOIN Problem ON Asset.[Asset Code No] =
Problem.[Asset Code No]) INNER JOIN [Contact Log] ON Problem.[Problem Number]
= [Contact Log].[Problem No]) ON User.[User ID] = [Contact Log].[User ID];

The thing is that when I do a select all from the problem table I get all
the results, but I do not when I use the SQL described above.

Any ideas as to what may be causing this?

Cheers in advance
  #2  
Old December 2nd, 2009, 03:43 PM posted to microsoft.public.access.queries
Jerry Whittle
external usenet poster
 
Posts: 4,732
Default Unable to bring back all results from table with query

You are using inner joins which means that there must be a matching record in
both tables or the record won't be returned.

Try changing the joins from the Problem table to Left or Right joins. If the
tables are small enough, you should be able to see which table doesn't have a
matching record.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


"Karrot_Bex" wrote:

For a uni assignment we have a designated query that we have to create.

But when I run the query, I get one result returned to me. I should have two
returned to me, as I have two records in the Problem table.

The SQL is:- SELECT Problem.[Problem Number], User.[User ID], User.[User
Name], User.[Job Title], User.Email, User.[Telephone No], Asset.[Asset Code
No], Problem.[Problem Description], Problem.[Current Activity Log],
Problem.[Solution Description]
FROM [User] INNER JOIN ((Asset INNER JOIN Problem ON Asset.[Asset Code No] =
Problem.[Asset Code No]) INNER JOIN [Contact Log] ON Problem.[Problem Number]
= [Contact Log].[Problem No]) ON User.[User ID] = [Contact Log].[User ID];

The thing is that when I do a select all from the problem table I get all
the results, but I do not when I use the SQL described above.

Any ideas as to what may be causing this?

Cheers in advance

  #3  
Old December 2nd, 2009, 03:43 PM posted to microsoft.public.access.queries
Jerry Whittle
external usenet poster
 
Posts: 4,732
Default Unable to bring back all results from table with query

You are using inner joins which means that there must be a matching record in
both tables or the record won't be returned.

Try changing the joins from the Problem table to Left or Right joins. If the
tables are small enough, you should be able to see which table doesn't have a
matching record.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


"Karrot_Bex" wrote:

For a uni assignment we have a designated query that we have to create.

But when I run the query, I get one result returned to me. I should have two
returned to me, as I have two records in the Problem table.

The SQL is:- SELECT Problem.[Problem Number], User.[User ID], User.[User
Name], User.[Job Title], User.Email, User.[Telephone No], Asset.[Asset Code
No], Problem.[Problem Description], Problem.[Current Activity Log],
Problem.[Solution Description]
FROM [User] INNER JOIN ((Asset INNER JOIN Problem ON Asset.[Asset Code No] =
Problem.[Asset Code No]) INNER JOIN [Contact Log] ON Problem.[Problem Number]
= [Contact Log].[Problem No]) ON User.[User ID] = [Contact Log].[User ID];

The thing is that when I do a select all from the problem table I get all
the results, but I do not when I use the SQL described above.

Any ideas as to what may be causing this?

Cheers in advance

  #4  
Old December 2nd, 2009, 03:43 PM posted to microsoft.public.access.queries
Jerry Whittle
external usenet poster
 
Posts: 4,732
Default Unable to bring back all results from table with query

You are using inner joins which means that there must be a matching record in
both tables or the record won't be returned.

Try changing the joins from the Problem table to Left or Right joins. If the
tables are small enough, you should be able to see which table doesn't have a
matching record.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


"Karrot_Bex" wrote:

For a uni assignment we have a designated query that we have to create.

But when I run the query, I get one result returned to me. I should have two
returned to me, as I have two records in the Problem table.

The SQL is:- SELECT Problem.[Problem Number], User.[User ID], User.[User
Name], User.[Job Title], User.Email, User.[Telephone No], Asset.[Asset Code
No], Problem.[Problem Description], Problem.[Current Activity Log],
Problem.[Solution Description]
FROM [User] INNER JOIN ((Asset INNER JOIN Problem ON Asset.[Asset Code No] =
Problem.[Asset Code No]) INNER JOIN [Contact Log] ON Problem.[Problem Number]
= [Contact Log].[Problem No]) ON User.[User ID] = [Contact Log].[User ID];

The thing is that when I do a select all from the problem table I get all
the results, but I do not when I use the SQL described above.

Any ideas as to what may be causing this?

Cheers in advance

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:48 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.