|
Posted by Bart op de grote markt on 08/31/07 13:58
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
Navigation:
[Reply to this message]
|