dbTalk Databases Forums  

Represent data with the similar column values to one row

comp.databases.ms-access comp.databases.ms-access


Discuss Represent data with the similar column values to one row in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Alex aalkor
 
Posts: n/a

Default Represent data with the similar column values to one row - 10-24-2011 , 08:38 AM






Hi there,
I am looking for the way to represent data with the similar column
value to one row.
A query retrieves 3 records AS IS, but I need one record.
Thanks, for your help

Table:
Name / 1 year / 2 year /3 year

AS IS

Name 1 year 2 year 3 year

1 John Smith A
2 John Smith B
3 John Smith A+
=================================

TO BE

Name 1 year 2 year 3 year

1 John Smith A A+ B

Reply With Quote
  #2  
Old   
Joan Wild
 
Posts: n/a

Default Re: Represent data with the similar column values to one row - 10-24-2011 , 10:31 AM






Alex aalkor wrote:

Quote:
Hi there,
I am looking for the way to represent data with the similar column
value to one row.
A query retrieves 3 records AS IS, but I need one record.
Thanks, for your help

Table:
Name / 1 year / 2 year /3 year

AS IS

Name 1 year 2 year 3 year

1 John Smith A
2 John Smith B
3 John Smith A+
=================================

TO BE

Name 1 year 2 year 3 year

1 John Smith A A+ B
See
Concatenate fields in same table
http://www.mvps.org/access/modules/mdl0008.htm

That answers your question, however if your design was normalized, you
have an easier time with querying the data.

Reply With Quote
  #3  
Old   
Joan Wild
 
Posts: n/a

Default Re: Represent data with the similar column values to one row - 10-24-2011 , 10:35 AM



Alex aalkor wrote:

Quote:
Hi there,
I am looking for the way to represent data with the similar column
value to one row.
A query retrieves 3 records AS IS, but I need one record.
Thanks, for your help

Table:
Name / 1 year / 2 year /3 year

AS IS

Name 1 year 2 year 3 year

1 John Smith A
2 John Smith B
3 John Smith A+
=================================

TO BE

Name 1 year 2 year 3 year

1 John Smith A A+ B
See
Concatenate fields in same table
http://www.mvps.org/access/modules/mdl0008.htm

That answers your question, however if your design was normalized, you
have an easier time with querying the data.

Reply With Quote
  #4  
Old   
Bob Barrows
 
Posts: n/a

Default Re: Represent data with the similar column values to one row - 10-24-2011 , 04:30 PM



Alex aalkor wrote:
Quote:
Hi there,
I am looking for the way to represent data with the similar column
value to one row.
A query retrieves 3 records AS IS, but I need one record.
Thanks, for your help

Table:
Name / 1 year / 2 year /3 year

AS IS

Name 1 year 2 year 3 year

1 John Smith A
2 John Smith B
3 John Smith A+
=================================

TO BE

Name 1 year 2 year 3 year

1 John Smith A A+ B
A simple grouping query would seem to be the answer here ...
Wait.
Are those numbers (1,2 and 3) a separate column in the table? Or are these
three different names in these three records? "1 John Smith", "2 John Smith"
and "3 John Smith"?

If the numbers are actually in a separate field, then the grouping query is
the answer:

select name, max([1 year]) As Year1, max([2 year]) As Year2, max([3 year])
As Year3
from tablename
group by name

If the numbers are part of the name, then you're going to need to tell us if
they are consistent. Do they always consist of a number followed by a space
and then a name? Or are there other formats we need to worry about? Also, if
similar does not mean "exactly the same" to you, you need to show us some
names that are not exactly the same yet need to be treated as "similar".

Reply With Quote
Reply




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 On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.