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  

Joined table: Returns duplicated record



 
 
Thread Tools Display Modes
  #1  
Old December 19th, 2007, 01:07 PM posted to microsoft.public.access.queries
Ali
external usenet poster
 
Posts: 221
Default Joined table: Returns duplicated record

I have 2 tables (hard to list down all attributes , so i give an example)

Table 1:
Name Nationality Birthday nickname school
allen Japan 01/Jan/2002 al ABC
SCHOOL
sarah USA 02/Feb/2003 sal BBB
SCHOOL
Nicole UK 03/Mar/2004 Nic CCC
SCHOOL

----------------------------------------------------------------------------
Table 2:
Code Nationality Birthday Remark
01 Japan 01/Jan/2002 good boy
02 USA 02/Feb/2003 Nice girl
03 UK 02/Mar/2004 ok person!
----------------------------------------------------------------------------
Problem:

I tried to join them to produce a new table, but i get double result for
each entry.

----------------------------------------------------------------------------
Question:

Can i use "DISTINCT" OR "GROUP BY" Function ?

If so, please show me the SQL .


Thanks you !


--
Allen Phailat Wongakanit
  #2  
Old December 19th, 2007, 02:49 PM posted to microsoft.public.access.queries
Duane Hookom
external usenet poster
 
Posts: 7,177
Default Joined table: Returns duplicated record

How did you join the tables? Could you share your SQL view of your query?
What are the primary and foreign keys in the tables?

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


"ali" wrote:

I have 2 tables (hard to list down all attributes , so i give an example)

Table 1:
Name Nationality Birthday nickname school
allen Japan 01/Jan/2002 al ABC
SCHOOL
sarah USA 02/Feb/2003 sal BBB
SCHOOL
Nicole UK 03/Mar/2004 Nic CCC
SCHOOL

----------------------------------------------------------------------------
Table 2:
Code Nationality Birthday Remark
01 Japan 01/Jan/2002 good boy
02 USA 02/Feb/2003 Nice girl
03 UK 02/Mar/2004 ok person!
----------------------------------------------------------------------------
Problem:

I tried to join them to produce a new table, but i get double result for
each entry.

----------------------------------------------------------------------------
Question:

Can i use "DISTINCT" OR "GROUP BY" Function ?

If so, please show me the SQL .


Thanks you !


--
Allen Phailat Wongakanit

  #3  
Old December 20th, 2007, 02:15 AM posted to microsoft.public.access.queries
Ali
external usenet poster
 
Posts: 221
Default Joined table: Returns duplicated record


Alright Hookom!, since this is a sample database, i'll try my best to
portrait my real situation. (cuz my real table contains too many attributes
!)

I joined

INNER JOIN (table1.Nationality = table2.nationality) and (table1.birthday =
table2.birthday)

I also want to display all attributes from both tables.

Thanks a lot again, Hookom !



--
Allen Phailat Wongakanit


"Duane Hookom" wrote:

How did you join the tables? Could you share your SQL view of your query?
What are the primary and foreign keys in the tables?

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


"ali" wrote:

I have 2 tables (hard to list down all attributes , so i give an example)

Table 1:
Name Nationality Birthday nickname school
allen Japan 01/Jan/2002 al ABC
SCHOOL
sarah USA 02/Feb/2003 sal BBB
SCHOOL
Nicole UK 03/Mar/2004 Nic CCC
SCHOOL

----------------------------------------------------------------------------
Table 2:
Code Nationality Birthday Remark
01 Japan 01/Jan/2002 good boy
02 USA 02/Feb/2003 Nice girl
03 UK 02/Mar/2004 ok person!
----------------------------------------------------------------------------
Problem:

I tried to join them to produce a new table, but i get double result for
each entry.

----------------------------------------------------------------------------
Question:

Can i use "DISTINCT" OR "GROUP BY" Function ?

If so, please show me the SQL .


Thanks you !


--
Allen Phailat Wongakanit

  #4  
Old December 20th, 2007, 04:00 AM posted to microsoft.public.access.queries
Duane Hookom
external usenet poster
 
Posts: 7,177
Default Joined table: Returns duplicated record

If you have two people with the same nationality and birthday, you will have
duplicated records.

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


"ali" wrote:


Alright Hookom!, since this is a sample database, i'll try my best to
portrait my real situation. (cuz my real table contains too many attributes
!)

I joined

INNER JOIN (table1.Nationality = table2.nationality) and (table1.birthday =
table2.birthday)

I also want to display all attributes from both tables.

Thanks a lot again, Hookom !



--
Allen Phailat Wongakanit


"Duane Hookom" wrote:

How did you join the tables? Could you share your SQL view of your query?
What are the primary and foreign keys in the tables?

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


"ali" wrote:

I have 2 tables (hard to list down all attributes , so i give an example)

Table 1:
Name Nationality Birthday nickname school
allen Japan 01/Jan/2002 al ABC
SCHOOL
sarah USA 02/Feb/2003 sal BBB
SCHOOL
Nicole UK 03/Mar/2004 Nic CCC
SCHOOL

----------------------------------------------------------------------------
Table 2:
Code Nationality Birthday Remark
01 Japan 01/Jan/2002 good boy
02 USA 02/Feb/2003 Nice girl
03 UK 02/Mar/2004 ok person!
----------------------------------------------------------------------------
Problem:

I tried to join them to produce a new table, but i get double result for
each entry.

----------------------------------------------------------------------------
Question:

Can i use "DISTINCT" OR "GROUP BY" Function ?

If so, please show me the SQL .


Thanks you !


--
Allen Phailat Wongakanit

  #5  
Old December 20th, 2007, 05:07 AM posted to microsoft.public.access.queries
Ali
external usenet poster
 
Posts: 221
Default Joined table: Returns duplicated record


--
Allen Phailat Wongakanit


"Duane Hookom" wrote:

If you have two people with the same nationality and birthday, you will have
duplicated records.

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


"ali" wrote:


Alright Hookom!, since this is a sample database, i'll try my best to
portrait my real situation. (cuz my real table contains too many attributes
!)

I joined

INNER JOIN (table1.Nationality = table2.nationality) and (table1.birthday =
table2.birthday)

I also want to display all attributes from both tables.

Thanks a lot again, Hookom !



--
Allen Phailat Wongakanit


"Duane Hookom" wrote:

How did you join the tables? Could you share your SQL view of your query?
What are the primary and foreign keys in the tables?

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


"ali" wrote:

I have 2 tables (hard to list down all attributes , so i give an example)

Table 1:
Name Nationality Birthday nickname school
allen Japan 01/Jan/2002 al ABC
SCHOOL
sarah USA 02/Feb/2003 sal BBB
SCHOOL
Nicole UK 03/Mar/2004 Nic CCC
SCHOOL

----------------------------------------------------------------------------
Table 2:
Code Nationality Birthday Remark
01 Japan 01/Jan/2002 good boy
02 USA 02/Feb/2003 Nice girl
03 UK 02/Mar/2004 ok person!
----------------------------------------------------------------------------
Problem:

I tried to join them to produce a new table, but i get double result for
each entry.

----------------------------------------------------------------------------
Question:

Can i use "DISTINCT" OR "GROUP BY" Function ?

If so, please show me the SQL .


Thanks you !


--
Allen Phailat Wongakanit

  #6  
Old June 27th, 2008, 02:59 PM posted to microsoft.public.access.queries
KC_Cheer_Coach[_2_]
external usenet poster
 
Posts: 32
Default Joined table: Returns duplicated record

So, how does he write it so the records do not duplicate? I have to do the
same thing and am currently writing seperate queries for each comparison I am
doing (answer to a similar question I asked in this community earlier),
however when I put these queries together with a union, they duplicate.

"Duane Hookom" wrote:

If you have two people with the same nationality and birthday, you will have
duplicated records.

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


"ali" wrote:


Alright Hookom!, since this is a sample database, i'll try my best to
portrait my real situation. (cuz my real table contains too many attributes
!)

I joined

INNER JOIN (table1.Nationality = table2.nationality) and (table1.birthday =
table2.birthday)

I also want to display all attributes from both tables.

Thanks a lot again, Hookom !



--
Allen Phailat Wongakanit


"Duane Hookom" wrote:

How did you join the tables? Could you share your SQL view of your query?
What are the primary and foreign keys in the tables?

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


"ali" wrote:

I have 2 tables (hard to list down all attributes , so i give an example)

Table 1:
Name Nationality Birthday nickname school
allen Japan 01/Jan/2002 al ABC
SCHOOL
sarah USA 02/Feb/2003 sal BBB
SCHOOL
Nicole UK 03/Mar/2004 Nic CCC
SCHOOL

----------------------------------------------------------------------------
Table 2:
Code Nationality Birthday Remark
01 Japan 01/Jan/2002 good boy
02 USA 02/Feb/2003 Nice girl
03 UK 02/Mar/2004 ok person!
----------------------------------------------------------------------------
Problem:

I tried to join them to produce a new table, but i get double result for
each entry.

----------------------------------------------------------------------------
Question:

Can i use "DISTINCT" OR "GROUP BY" Function ?

If so, please show me the SQL .


Thanks you !


--
Allen Phailat Wongakanit

  #7  
Old June 27th, 2008, 04:01 PM posted to microsoft.public.access.queries
Duane Hookom
external usenet poster
 
Posts: 7,177
Default Joined table: Returns duplicated record

Joins should generally include a unique field or fields on one side of the
join. If you don't have unique values, you may have duplicates. If you have
specific examples, someone might be able to help you.
--
Duane Hookom
Microsoft Access MVP


"KC_Cheer_Coach" wrote:

So, how does he write it so the records do not duplicate? I have to do the
same thing and am currently writing seperate queries for each comparison I am
doing (answer to a similar question I asked in this community earlier),
however when I put these queries together with a union, they duplicate.

"Duane Hookom" wrote:

If you have two people with the same nationality and birthday, you will have
duplicated records.

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


"ali" wrote:


Alright Hookom!, since this is a sample database, i'll try my best to
portrait my real situation. (cuz my real table contains too many attributes
!)

I joined

INNER JOIN (table1.Nationality = table2.nationality) and (table1.birthday =
table2.birthday)

I also want to display all attributes from both tables.

Thanks a lot again, Hookom !



--
Allen Phailat Wongakanit


"Duane Hookom" wrote:

How did you join the tables? Could you share your SQL view of your query?
What are the primary and foreign keys in the tables?

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


"ali" wrote:

I have 2 tables (hard to list down all attributes , so i give an example)

Table 1:
Name Nationality Birthday nickname school
allen Japan 01/Jan/2002 al ABC
SCHOOL
sarah USA 02/Feb/2003 sal BBB
SCHOOL
Nicole UK 03/Mar/2004 Nic CCC
SCHOOL

----------------------------------------------------------------------------
Table 2:
Code Nationality Birthday Remark
01 Japan 01/Jan/2002 good boy
02 USA 02/Feb/2003 Nice girl
03 UK 02/Mar/2004 ok person!
----------------------------------------------------------------------------
Problem:

I tried to join them to produce a new table, but i get double result for
each entry.

----------------------------------------------------------------------------
Question:

Can i use "DISTINCT" OR "GROUP BY" Function ?

If so, please show me the SQL .


Thanks you !


--
Allen Phailat Wongakanit

 




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 11:47 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.