I have the following table:
SELECT 'A' as Item, '1' as Version, 0 as Counter, '01-01-2011' as CreatedDate UNION ALL
SELECT 'A' as Item, '1.1' as Version, 1 as Counter, '01-02-2011' as CreatedDate UNION ALL
SELECT 'A' as Item, '1.2' as Version, 2 as Counter, '01-03-2011' as CreatedDate UNION ALL
SELECT 'B' as Item, '1.2' as Version, 0 as Counter, '01-01-2011' as CreatedDate UNION ALL
SELECT 'B' as Item, '2' as Version, 1 as Counter, '01-10-2011' as CreatedDate UNION ALL
SELECT 'C' as Item, '1.5' as Version, 0 as Counter, '05-03-2011' as CreatedDate UNION ALL
SELECT 'C' as Item, '2.5' as Version, 1 as Counter, '05-04-2011' as CreatedDate UNION ALL
SELECT 'C' as Item, '3' as Version, 2 as Counter, '05-05-2011' as CreatedDate UNION ALL
SELECT 'C' as Item, '2' as Version, 3 as Counter, '06-01-2011' as CreatedDate UNION ALL
SELECT 'D' as Item, '1.3' as Version, 0 as Counter, '01-10-2011' as CreatedDate UNION ALL
SELECT 'D' as Item, '1.2' as Version, 1 as Counter, '03-10-2011' as CreatedDate UNION ALL
SELECT 'D' as Item, '3' as Version, 2 as Counter, '04-10-2011' as CreatedDate
I want to write a script where if a user enters the version number, then the output should show all the upward and downward nodes..e.g. if a user selects '1.2' version then following should be the output
Can someone please help me with this?
Thank you in advance