1 |
6311
|
aaronmk
|
CREATE TABLE "FIA_COND_unique" AS
|
2 |
|
|
SELECT
|
3 |
|
|
DISTINCT ON ("PLT_CN")
|
4 |
|
|
*
|
5 |
|
|
FROM "FIA_COND"
|
6 |
|
|
;
|
7 |
|
|
|
8 |
|
|
ALTER TABLE "FIA_COND_unique" ADD PRIMARY KEY ("PLT_CN");
|
9 |
|
|
|
10 |
|
|
--ALTER TABLE "FIA_COND_unique" ADD COLUMN oldgrowth boolean;
|
11 |
|
|
ALTER TABLE "FIA_COND_unique" ALTER COLUMN oldgrowth TYPE boolean
|
12 |
|
|
USING
|
13 |
|
|
(
|
14 |
|
|
"STDAGE">80
|
15 |
|
|
AND ("TRTCD1"='0' OR "TRTCD1" IS NULL)
|
16 |
|
|
AND (("DSTRBCD1"<>'30' AND "DSTRBCD1"<>'31' AND "DSTRBCD1"<>'32' AND "DSTRBCD1"<>'80') OR "DSTRBCD1" IS NULL)
|
17 |
|
|
AND ("STUMP_CD_PNWRS"='N' OR "STUMP_CD_PNWRS" IS NULL)
|
18 |
|
|
AND "HARVEST_TYPE1_SRS" IS NULL
|
19 |
|
|
AND "PRESNFCD" IS NULL
|
20 |
|
|
AND ("STDORGCD"=0 OR "STDORGCD" IS NULL)
|
21 |
|
|
)
|
22 |
|
|
OR "STND_COND_CD_PNWRS"='7'
|
23 |
|
|
;
|