473,320 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Irregular Results From JOIN

233 100+
I have table A which has 202 unique record and table B which has 102 unique records. The 102 values in table B came from table A, so there are 100 other records in table A. However, the following query only returns 75 rows:

SELECT *
FROM TableA A JOIN
TableB B ON B.CONTACTID=A.CONTACTID

Given CONTACTID is the PK for each table, what am I doing wrong here?
Oct 10 '08 #1
4 1178
code green
1,726 Expert 1GB
if there are 102 matching IDs but only 75 are returned
it is probably the IDs have acquired extra spaces.
Use RTRIM. LTRIM
Oct 10 '08 #2
mcfly1204
233 100+
if there are 102 matching IDs but only 75 are returned
it is probably the IDs have acquired extra spaces.
Use RTRIM. LTRIM
I appreciate the response, but given the values in TableB came directly from TableA, there is not a chance of extra spaces being added.
Oct 10 '08 #3
ck9663
2,878 Expert 2GB
Is there a NULL value on your CONTACTID? I assume it's the primary key. Try doing a left join and see what the query returns.

-- CK
Oct 10 '08 #4
Delerna
1,134 Expert 1GB
Hi
I am assuming the fields are character fields because extra spaces are mentioned

given the values in TableB came directly from TableA, there is not a chance of extra spaces being added.
Umm, there is a chance
If the field in tableA is varchar and the field in tableB is char then there could be extra spaces added to the fields in tableB even though it's records came directly from tableA

Could this be the case?

Looking at your query I cannot see anything that you are doing wrong!
So it suggests a field type mismatch of some sort
Regards
Oct 11 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: david liu | last post by:
access 2000 query: here's what i want to do. from an asp page, perform a search on a table in access. i have used sql code in the asp page itself, but i'd rather execute a query in access. i...
6
by: Alan | last post by:
I'm just about to start a project that needs to combine the results of a SQL Server query with the results of an Index Server query. The basic idea is that the user enters/selects a bunch of search...
0
by: Soefara | last post by:
Dear Sirs, I am experiencing strange results when trying to optimize a LEFT JOIN on 3 tables using MySQL. Given 3 tables A, B, C such as the following: create table A ( uniqueId int not...
4
by: keithb | last post by:
It looks like the span tag cannot be used with asp tables. What is the best way to make an irregular asp table? Thanks, Keith
33
by: genc_ymeri | last post by:
Hi over there, Propably this subject is discussed over and over several times. I did google it too but I was a little bit surprised what I read on internet when it comes 'when to use what'. Most...
2
by: mmitchell_houston | last post by:
I'm working on a .NET project and I need a single query to return a result set from three related tables in Access 2003, and I'm having trouble getting the results I want. The details: ...
0
by: dr | last post by:
C# Irregular shaped user controls. How to make usercontrol have transparency key for its background image? I want to have irregular shaped user controls on my form. like a funny shaped button....
2
by: KTosser | last post by:
I have two tables, one contains contacts and the other has all the events and years that the contacts participated in. What I want is to be able to choose the years, say 2005 and 2006, and get all...
6
by: Nobody | last post by:
hi there, suppose I want to iterate for a specific variable e.g. i , but for non regular (or consecutive) values. For example i=0,1,2,4,5,7,8 etc how can I do that with a for loop? MY...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.