You are here: problem with subselect « MsSQL Server « IT news, forums, messages
problem with subselect

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]


Удаленная работа для программистов  •  Как заработать на 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

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