-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathocr_targets.sql
More file actions
147 lines (145 loc) · 5.58 KB
/
ocr_targets.sql
File metadata and controls
147 lines (145 loc) · 5.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
select min(parcel_number), max(parcel_number), count(parcel_number) from "MonthlyTax";
select min("PARCELID"), max("PARCELID"), count("PARCELID") from "BuildingInfo";
select distinct "PARCELID" from "BuildingInfo" except (select distinct parcel_number from "MonthlyTax" where prop_class_code = 510);
(select distinct parcel_number from "MonthlyTax" where prop_class_code = 510) except select distinct "PARCELID" from "BuildingInfo";
(select distinct parcel_number from "MonthlyTax" where prop_class_code = 510) intersect select distinct "PARCELID" from "BuildingInfo";
with subset(
parcel_number ,
"2_5_flag" ,
homestead_flag ,
book ,
page ,
property_id ,
mltown ,
prop_class_code ,
class_description ,
appraisal_area ,
area_description ,
owner_name_1 ,
owner_name_2 ,
owner_address_1 ,
owner_address_2 ,
owner_city ,
owner_state ,
owner_zip ,
location_house_number ,
location_street_direction ,
location_street_name ,
location_street_suffix ,
location_city ,
location_state ,
location_zip ,
mailing_name_1 ,
mailing_name_2 ,
mailing_address_1 ,
mailing_address_2 ,
mailing_city ,
mailing_state ,
mailing_zip ,
property_description ,
divided_flag ,
new_construction_flag ,
spec_assess_flag ,
school_district ,
school_district_desc ,
tax_district ,
tax_district_desc ,
foreclosure_flag ,
deeded_acreage ,
rental_registration_flag ,
bor_flag ,
transfer_date ,
sale_amount ,
num_parcels ,
conveyance_number ,
deed_number ,
sale_source ,
sale_type ,
previous_owner_name_1 ,
previous_owner_name_2 ,
ag_use ,
market_land_value ,
market_impr_value ,
total_market_value ,
annual_taxes ,
annual_taxes_paid ,
delinquent_taxes ,
delinquent_taxes_paid ,
active_flag ,
initial_sale_price
) as (
select
parcel_number ,
"2_5_flag" ,
homestead_flag ,
book ,
page ,
property_id ,
mltown ,
prop_class_code ,
class_description ,
appraisal_area ,
area_description ,
owner_name_1 ,
owner_name_2 ,
owner_address_1 ,
owner_address_2 ,
owner_city ,
owner_state ,
owner_zip ,
location_house_number ,
location_street_direction ,
location_street_name ,
location_street_suffix ,
location_city ,
location_state ,
location_zip ,
mailing_name_1 ,
mailing_name_2 ,
mailing_address_1 ,
mailing_address_2 ,
mailing_city ,
mailing_state ,
mailing_zip ,
property_description ,
divided_flag ,
new_construction_flag ,
spec_assess_flag ,
school_district ,
school_district_desc ,
tax_district ,
tax_district_desc ,
foreclosure_flag ,
deeded_acreage ,
rental_registration_flag ,
bor_flag ,
transfer_date ,
sale_amount ,
num_parcels ,
conveyance_number ,
deed_number ,
sale_source ,
sale_type ,
previous_owner_name_1 ,
previous_owner_name_2 ,
ag_use ,
market_land_value ,
market_impr_value ,
total_market_value ,
annual_taxes ,
annual_taxes_paid ,
delinquent_taxes ,
delinquent_taxes_paid ,
active_flag ,
null::bigint as initial_land_value,
null::bigint as initial_building_value
from "MonthlyTax"
where prop_class_code = 510
order by random()
limit 200)
select *
into OCRTargets
from subset
left join "BuildingInfo"
on parcel_number = "PARCELID"
order by parcel_number;