Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 creating one by one concordance

Author  Topic 

goligol
Posting Yak Master

128 Posts

Posted - 2012-07-18 : 14:36:18
hello,
I am posting my request again in another form:

I would like to change the table A below to table B. Table A is the output of the following in which fmb_io is related to moere than one miters_io. I would like to keep the distinct number of fmb_io with only and only one miters_io assigned to it. It doesnt matter what miters_io to be picked up, only want to have one to one concordance:

SELECT [fmb_io]
,[miters_io]
FROM [BLS].[IO2012].[io_concord_new]
order by fmb_io

A:
fmb_io miters_io
1 111335
1 1111A0
1 111400
1 1119A0
1 111910
2 112100
2 112100
2 112300
2 112A00
3 113A00
4 113300
5 114100
5 114200
6 115000
7 211000
8 212100
9 212210
9 2122A0


B:
fmb_io miters_io
1 111335
2 112100
3 113A00
4 113300
5 114100
6 115000
7 211000
8 212100
9 212210

robvolk
Most Valuable Yak

15732 Posts

Posted - 2012-07-18 : 14:39:09
Does it have to be a table? (and why?) What about:
CREATE VIEW B([fmb_io],[miters_io]) AS
SELECT [fmb_io], MIN([miters_io])
FROM [BLS].[IO2012].[io_concord_new]
GROUP BY [fmb_io]
Go to Top of Page

goligol
Posting Yak Master

128 Posts

Posted - 2012-07-18 : 14:40:00
of course it can be a view! I will try it right now, hope it works, thank youuuuuuuuu.
Go to Top of Page
   

- Advertisement -