Combine two records in a table

C

clk

Hi. I have a database that I am using to manipulate data to export
to
another program. I import a text file, make modification and then
export another text file with all the modifications. One thing that
happens is the original file that is imported may contain duplicate
records.

Below is a scenario that exists.

Point_Name x1 y1 x2
y2
1 123 465
2 888 999
2 777 000
4 456 566


What I need is below. The end result should be that Point_Name "2"
get combined with the other Point_Name "2". The top one leaves the x1/
y1 coordinates alone but the second Point-Name2 x1/y1 coordinates get
placed in x2/y2 fields.


Point_Name x1 y1 x2 y2
1 123 465
2 888 999 777
000
4 456 566


I hope this makes sense. x2 and y2 are blank unless there are two
identical
Point-Names. Any help would be greatly appreciated.


Thank you.
 
C

clk

What happens if there are more than 2 identical Point-Names?

Here's how you can get a list of the dupe Point-Names:

SELECT  [Point-Names], [x1], [y1], [x2], [y2]
FROM YourTable
WHERE [Point-Names] In (SELECT [Point-Names] FROM [YourTable] As Tmp GROUP
BY [Point-Names] HAVING Count(*)>1 )
ORDER BY [Point-Names];

--
Arvin Meyer, MCP, MVPhttp://www.datastrat.comhttp://www.accessmvp.comhttp://www.mvps.org/access
Co-author: "Access Solutions", published by Wiley




Hi.  I have a database that I am using to manipulate data to export
to
another program.  I import a text file, make modification and then
export another text file with all the modifications.  One thing that
happens is the original file that is imported may contain duplicate
records.
Below is a scenario that exists.
Point_Name   x1                  y1             x2
y2
1                   123               465
2                   888               999
2                   777               000
4                    456              566
What I need is below.  The end result should be that Point_Name "2"
get combined with the other Point_Name "2".  The top one leaves the x1/
y1 coordinates alone but the second Point-Name2 x1/y1 coordinates get
placed in x2/y2 fields.
Point_Name   x1                  y1         x2                   y2
1                   123               465
2                   888               999         777
000
4                  456              566
I hope this makes sense.  x2 and y2 are blank unless there are two
identical
Point-Names.  Any help would be greatly appreciated.
Thank you.- Hide quoted text -

- Show quoted text -

Thank you for the suggestion. I am working on it now. They assure me
that there will never be more than two. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top