table record is like this and i find out result according to autoId 5
the result show according to auto id 5
show record like this
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Amit ChoudharyRank #145 · 15.8K reputationPosted Jun 10, 2013, 2:06 AM EDT
Bhupendra SinghRank #4,382 · 347 reputationPosted Jun 10, 2013, 2:33 AM EDT
suppose my id is 3 then result should be select id only: 1
if we select id is 4 then result should be select id only: 3,1
Jignesh TrivediRank #16 · 50.3K reputationPosted Jun 10, 2013, 6:54 PM EDT
I am not understand your question clearly but try following query
select max(AutoId) as AutoId,ParentId from #temp
group by ParentId
hope this will help you.
Iftikar HussainRank #423 · 5.9K reputationPosted Jun 14, 2013, 2:42 AM EDT
You can use hierarchyid datatype.
You can refer this
http://technet.microsoft.com/en-us/library/bb677173.aspx
Regards,
Iftikar