How to find nested level using sql server 2000 script -



How to find nested level using sql server 2000 script -

i have 2 tables:(all columns'datatype bigint)

table1 has 2 columns: item , type table2 has 6 columns: no, semiid, level, elementid, elevel , type semiid, elementid in table2 item in table1 and got info in 2 table this: item|type ---------- 1 | 0 2 | 0 3 | 0 4 | 0 5 | 0 6 | 0 7 | 0 8 | 0 9 | 0 10 | 1 11 | 1 12 | 1 13 | 1 14 | 1 15 | 1 16 | 1 17 | 1 no |semiid | level |elementid| elevel |type ---------------------------------------------- 1 | 10 | null | 1 | null | 0 2 | 10 | null | 2 | null | 0 3 | 10 | null | 3 | null | 0 4 | 10 | null | 4 | null | 0 5 | 11 | null | 7 | null | 0 6 | 11 | null | 8 | null | 0 7 | 11 | null | 9 | null | 0 8 | 12 | null | 10 | null | 1 9 | 12 | null | 11 | null | 1 10 | 12 | null | 5 | null | 0 11 | 13 | null | 12 | null | 1 12 | 13 | null | 11 | null | 1 13 | 13 | null | 1 | null | 0 14 | 13 | null | 2 | null | 0 15 | 14 | null | 13 | null | 1 16 | 14 | null | 12 | null | 1 17 | 14 | null | 10 | null | 1 18 | 14 | null | 3 | null | 0 19 | 15 | null | 13 | null | 1 20 | 15 | null | 11 | null | 1 21 | 15 | null | 10 | null | 1 22 | 15 | null | 3 | null | 0 23 | 16 | null | 14 | null | 1 24 | 16 | null | 11 | null | 1 25 | 16 | null | 5 | null | 0 26 | 17 | null | 16 | null | 1 27 | 17 | null | 6 | null | 0

and result:

no |semiid |level |elementid | elevel| type --------------------------------------------- 1 | 10 | 0 | 1 | -1 | 0 2 | 10 | 0 | 2 | -1 | 0 3 | 10 | 0 | 3 | -1 | 0 4 | 10 | 0 | 4 | -1 | 0 5 | 11 | 0 | 7 | -1 | 0 6 | 11 | 0 | 8 | -1 | 0 7 | 11 | 0 | 9 | -1 | 0 8 | 12 | 1 | 10 | 0 | 1 9 | 12 | 1 | 11 | 0 | 1 10 | 12 | 1 | 5 | -1 | 0 11 | 13 | 2 | 12 | 1 | 1 12 | 13 | 2 | 11 | 0 | 1 13 | 13 | 2 | 1 | -1 | 0 14 | 13 | 2 | 2 | -1 | 0 15 | 14 | 3 | 13 | 2 | 1 16 | 14 | 3 | 12 | 1 | 1 17 | 14 | 3 | 10 | 0 | 1 18 | 14 | 3 | 3 | -1 | 0 19 | 15 | 3 | 13 | 2 | 1 20 | 15 | 3 | 11 | 0 | 1 21 | 15 | 3 | 10 | 0 | 1 22 | 15 | 3 | 3 | -1 | 0 23 | 16 | 4 | 14 | 3 | 1 24 | 16 | 4 | 11 | 0 | 1 25 | 16 | 4 | 5 | -1 | 0 26 | 17 | 5 | 16 | 4 | 1 27 | 17 | 5 | 6 | -1 | 0

how write tsql script in sql server 2000 result?

sql sql-server sql-server-2008

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -