found very interesting artile here.
Worth a look and some thought.
Tuesday, September 26, 2006
Monday, September 25, 2006
Query hierarchical data - SQL 2005
Question:
Table data...
Line Name ForLine
1 Stuff 0
2 SubStuff 1
3 SubSubStuff 2
4 Other 0
5 SubOther 4
6 LowStuff 3
Result required...
Line Name ForLine TopName
3 SubSubStuff 2 Stuff
Gabbar:
WITH MyTree (Line, Name, ForLine, TopName)
AS
(
-- Anchor member definition
SELECT
Line,
Name,
ForLine,
Name as TopName
FROM
MyTable
WHERE
ForLine = 0
UNION ALL
-- Recursive member definition
SELECT
m.Line,
m.Name,
m.ForLine,
t.TopName
FROM
MyTable m
INNER JOIN MyTree t
ON m.ForLine = t.Line
)
SELECT
Line,
Name,
ForLine,
TopName
FROM
MyTree
WHERE
Line = 3
Table data...
Line Name ForLine
1 Stuff 0
2 SubStuff 1
3 SubSubStuff 2
4 Other 0
5 SubOther 4
6 LowStuff 3
Result required...
Line Name ForLine TopName
3 SubSubStuff 2 Stuff
Gabbar:
WITH MyTree (Line, Name, ForLine, TopName)
AS
(
-- Anchor member definition
SELECT
Line,
Name,
ForLine,
Name as TopName
FROM
MyTable
WHERE
ForLine = 0
UNION ALL
-- Recursive member definition
SELECT
m.Line,
m.Name,
m.ForLine,
t.TopName
FROM
MyTable m
INNER JOIN MyTree t
ON m.ForLine = t.Line
)
SELECT
Line,
Name,
ForLine,
TopName
FROM
MyTree
WHERE
Line = 3
Wednesday, September 20, 2006
बराहाचा शोध
छानच लिहीता येते बराहा वापरुन. हा माझा पहिलाच प्रयोग आहे मराठी लिहिन्याचा. ठ लिहीणे जरा जडच गेले.
Tuesday, September 19, 2006
a win .. at last
I thought, I have forgotten how to win a chess game. But no, rising from the ashes, I won this, and that too with white pieces......
1. e4 e6 2. f4 d5 3. Nf3 d4 4. Bc4 c5 5. d3 a6 6. f5 b5 7. fxe6 bxc4 8. exf7+ Kxf7 9. Ne5+ Ke8 10. Qh5+ 11. Nxg6 12. Qe5+ 13. Nxh8 14. Qe6 15. Qf7#
1. e4 e6 2. f4 d5 3. Nf3 d4 4. Bc4 c5 5. d3 a6 6. f5 b5 7. fxe6 bxc4 8. exf7+ Kxf7 9. Ne5+ Ke8 10. Qh5+ 11. Nxg6 12. Qe5+ 13. Nxh8 14. Qe6 15. Qf7#
Subscribe to:
Posts (Atom)