|
Posted by Shiju Samuel on 08/31/07 16:20
Please post table structure. Also let us know what you want to update.
-
Shiju Samuel
On Aug 31, 6:58 pm, Bart op de grote markt <warn...@googlemail.com>
wrote:
> Hello,
>
> I have a problem with a subselect I use in a stored procedure:
>
> UPDATE #TEMP_TABLE
> SET P_ID_1=(SELECT top 1 b.P_ID_1 from #TEMP_TABLE b where
> b.ID=PARENT_ID),
> P_ID_2=PARENT_ID,
> P_ID_3=ID
> WHERE PARENT_ID IN (SELECT P_ID_2
> FROM #TEMP_TABLE b)
>
> So the subselect is (SELECT top 1 b.P_ID_1 from #TEMP_TABLE b where
> b.ID=PARENT_ID), and it returns NULL. The cause of that is most
> probably the fact that I try to link ID from inner table b with
> PARENT_ID from the outer table. I thought it had to be done this way,
> but obviously not. Can somebody help me with this syntax problem?
>
> Thx,
>
> Bart
[Back to original message]
|