Mercurial > hg > tema
view misc/biotopes/biotope-top.sql @ 4:9f950416a439
Replaced .cvsignore with .hgignore. Fixed permissions.
author | Mikhail Kryshen <mikhail@kryshen.net> |
---|---|
date | Thu, 06 Nov 2008 23:34:50 +0300 |
parents | 6c41a0b43e58 |
children |
line wrap: on
line source
SELECT t1.*, (SELECT t2.rusname FROM biotopelist AS t2 WHERE Left(t2.rangcode, 1) = Left(t1.rangcode, 1) AND Right(t2.rangcode, 8) = '00000000') AS class0, (SELECT t2.rusname FROM biotopelist AS t2 WHERE Left(t2.rangcode, 3) = Left(t1.rangcode, 3) AND Right(t2.rangcode, 6) = '000000') AS class1, (SELECT t2.rusname FROM biotopelist AS t2 WHERE Left(t2.rangcode, 5) = Left(t1.rangcode, 5) AND Right(t2.rangcode, 4) = '0000') AS class2, (SELECT t2.rusname FROM biotopelist AS t2 WHERE Left(t2.rangcode, 7) = Left(t1.rangcode, 7) AND Right(t2.rangcode, 2) = '00') AS class3 FROM biotopelist AS t1 WHERE Right(t1.rangcode, 2) <> '00' AND rusname