[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.sqlserver.programming

replace data in column from another column

Brian

3/28/2007 4:22:00 PM

I have the following query which returns data that is not the same in
two columns:

select ord_no, cus_no, bill_to_no, *

from oeordhdr_sql

where bill_to_no is not null and cus_no <> bill_to_no

I need to create a query where it will take these results and change
the bill_to_no to be the same as the cus_no. for every row. Any help
is greatly appreciated.

Brian

3 Answers

Immy

3/28/2007 4:27:00 PM

0

UPDATE TABLE SET COLNAME1 = COLNAME2
?


"Brian" <barmand@amphenolpcd.com> wrote in message
news:1175098922.797992.129720@p77g2000hsh.googlegroups.com...
>I have the following query which returns data that is not the same in
> two columns:
>
> select ord_no, cus_no, bill_to_no, *
>
> from oeordhdr_sql
>
> where bill_to_no is not null and cus_no <> bill_to_no
>
> I need to create a query where it will take these results and change
> the bill_to_no to be the same as the cus_no. for every row. Any help
> is greatly appreciated.
>
> Brian
>


masri999

3/28/2007 5:47:00 PM

0

On Mar 28, 9:22 pm, "Brian" <barm...@amphenolpcd.com> wrote:
> I have the following query which returns data that is not the same in
> two columns:
>
> select ord_no, cus_no, bill_to_no, *
>
> from oeordhdr_sql
>
> where bill_to_no is not null and cus_no <> bill_to_no
>
> I need to create a query where it will take these results and change
> the bill_to_no to be the same as the cus_no. for every row. Any help
> is greatly appreciated.
>
> Brian

update oeordhdr_sql
set bill_to_no =cus_no
where bill_to_no is not null and cus_no <> bill_to_no

Brian

3/28/2007 7:01:00 PM

0

This works. thanks very much.

Brian