You are here: Re: update one colum with other column value in same table using update table statement « MsSQL Server « IT news, forums, messages
Re: update one colum with other column value in same table using update table statement

Posted by Manikandan on 06/14/07 16:27

On 14 Jun, 17:21, Manikandan <plmanikan...@gmail.com> wrote:
> Hi,
> I have table with three columns as below
> table name:exp
> No(int) name(char) refno(int)
>
> I have data as below
> No name refno
> 1 a
> 2 b
> 3 c
>
> I need to update the refno with no values I write a query as below
>
> update exp set refno=(select no from exp)
> when i run the query i got error as
> Subquery returned more than 1 value. This is not permitted when the
> subquery follows =, !=, <, <= , >, >= or when the subquery is used as
> an expression.
>
> I need to update one colum with other column value.
> What is the correct query for this ?
>
> Thanks,
> Mani

Hi,
I used a query as below

update exp set refno=(select no from exp a where exp.NO =a.NO)

It works fine.
Is it correct?

Thanks,
Mani

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация