1 |
7413
|
aaronmk
|
SELECT
|
2 |
|
|
DISTINCT ON ("PLT_CN")
|
3 |
|
|
*
|
4 |
|
|
,
|
5 |
|
|
(
|
6 |
|
|
"STDAGE"::integer>80
|
7 |
|
|
AND ("TRTCD1"='0' OR "TRTCD1" IS NULL)
|
8 |
|
|
AND (("DSTRBCD1"<>'30' AND "DSTRBCD1"<>'31' AND "DSTRBCD1"<>'32' AND "DSTRBCD1"<>'80') OR "DSTRBCD1" IS NULL)
|
9 |
|
|
AND ("STUMP_CD_PNWRS"='N' OR "STUMP_CD_PNWRS" IS NULL)
|
10 |
|
|
AND "HARVEST_TYPE1_SRS" IS NULL
|
11 |
|
|
AND "PRESNFCD" IS NULL
|
12 |
|
|
AND ("STDORGCD"='0' OR "STDORGCD" IS NULL)
|
13 |
|
|
)
|
14 |
|
|
OR "STND_COND_CD_PNWRS"='7'
|
15 |
|
|
AS oldgrowth
|
16 |
|
|
FROM "COND"
|
17 |
|
|
;
|
18 |
|
|
|
19 |
|
|
ALTER TABLE :table ADD PRIMARY KEY ("PLT_CN");
|