Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subquery returned more than 1 row error

Status
Not open for further replies.

jfcox

Programmer
Jul 11, 2001
44
US
I have a table with three columns; column a is an identity column, column b is just an id number, and column c is a date. I have several blanks in the date column and want to replace them with nulls. I tried the following query which fails on a "subquery returned more than 1 row" error and I just don't get it.

Update MyTable
set ColumnC = NULL
where columnC = ''

I also tried:
Update MyTable
set ColumnC = NULL
where columnC = '' and columA in (a hardcoded list of values I put in manually)


I'm sure there is a simple answer but I just don't see it. Any help appreciated!

Jim
 
Try

UPDATE Mytable
SET ColumnC = NULL
Where ColumnA IN(select ColumnA from Mytable
WHERE ColumnC = '')


Phil Hegedusich
Senior Programmer/Analyst
IIMAK
-----------
Eschewing obfuscation diurnally.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top