DECLARE @ItemCode nvarchar(20)
DECLARE @TMP int
SELECT @TMP=COUNT(*)
FROM(
SELECT DISTINCT T0.[Father] FROM ITT1 T0 
WHERE T0.father NOT IN (
			SELECT code
			FROM ITT1 WHERE code is not null
		)
)T0 WHERE T0.father='[%0]' ;
SET @ItemCode='[%0]';

发表回复

后才能评论