>Thank you for your reply me... but in my case i don't know CTE , how can do it ?
Hi,
You need something like this:
WITH Tests(tid, tname, counts) AS
(
SELECT id, Name, 0 AS counts
FROM Iden
UNION ALL
SELECT id, Name, counts + 1
FROM Iden I
JOIN Tests T ON
T.tid = I.id
)
SELECT id, Name, T.counts
FROM Iden I
JOIN Tests T ON
T.tid = I.id
Check this link:
http://msdn.microsoft.com/en-us/library/ms186243.aspx
Help others is first think you must do.