Re: Query - REPLACE using an INNER JOIN
- From: Ed Murphy <emurphy42@xxxxxxxxxxxx>
- Date: Wed, 29 Aug 2007 01:10:09 -0700
angela.y.austin@xxxxxxxxx wrote:
I'm running the query below to replace one letter.
I run
SELECT replace(ePPA_No, 'n', 'Y')
FROM medman_purge INNER JOIN
in4_purge ON medman_purge.Col001 = in4_purge.eppa_no
with no problem, and it replaces the 'N' with 'Y' perfectly. When I
try to set it using this query:
update in4_purge
set eppa_no =
(SELECT replace(ePPA_No, 'n', 'Y')
FROM medman_purge INNER JOIN
in4_purge ON medman_purge.Col001 = in4_purge.eppa_no)
I get this error:
Server: Msg 512, Level 16, State 1, Line 1
Subquery returned more than 1 value. This is not permitted when the
subquery follows =, !=, <, <= , >, >= or when the subquery is used as
an expression.
The statement has been terminated.
What am I doing wrong?
At least one row in in4_purge has two or more associated rows
in medman_purge. Try the following:
update in4_purge
set eppa_no = replace(eppa_no, 'n', 'Y')
where eppa_no in (select Col001 from medman_purge)
.
- References:
- Query - REPLACE using an INNER JOIN
- From: angela.y.austin@xxxxxxxxx
- Query - REPLACE using an INNER JOIN
- Prev by Date: Alter column on the large table.
- Next by Date: SQL Server 2000 MSDE Workload Governor lasts for how long?
- Previous by thread: Query - REPLACE using an INNER JOIN
- Next by thread: Re: Query - REPLACE using an INNER JOIN
- Index(es):