view misc/biotopes/biotope.sql @ 2:6c41a0b43e58

Tema 0.3 (imported from CVS).
author Mikhail Kryshen <mikhail@kryshen.net>
date Tue, 19 Feb 2008 20:32:17 +0300
parents
children
line source
1 SELECT t1.*,
3 (SELECT t2.rusname FROM biotopelist AS t2
4 WHERE Left(t2.rangcode, 1) = Left(t1.rangcode, 1)
5 AND Right(t2.rangcode, 8) = '00000000'
6 AND Right(t1.rangcode, 8) <> '00000000') AS class0,
8 (SELECT t2.rusname FROM biotopelist AS t2
9 WHERE Left(t2.rangcode, 3) = Left(t1.rangcode, 3)
10 AND Right(t2.rangcode, 6) = '000000'
11 AND Right(t1.rangcode, 6) <> '000000') AS class1,
13 (SELECT t2.rusname FROM biotopelist AS t2
14 WHERE Left(t2.rangcode, 5) = Left(t1.rangcode, 5)
15 AND Right(t2.rangcode, 4) = '0000'
16 AND Right(t1.rangcode, 4) <> '0000') AS class2,
18 (SELECT t2.rusname FROM biotopelist AS t2
19 WHERE Left(t2.rangcode, 7) = Left(t1.rangcode, 7)
20 AND Right(t2.rangcode, 2) = '00'
21 AND Right(t1.rangcode, 2) <> '00') AS class3
23 FROM biotopelist AS t1
24 WHERE rusname