File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 1+ * .todo
12* .7z
23* .xml
34* .pyc
Original file line number Diff line number Diff line change @@ -9,3 +9,26 @@ CREATE INDEX ph_creation_date_idx ON PostHistory USING btree (CreationDate)
99 WITH (FILLFACTOR = 100 );
1010CREATE INDEX ph_userid_idx ON PostHistory USING btree (UserId)
1111 WITH (FILLFACTOR = 100 );
12+
13+
14+ CREATE TABLE accepted_answer_id as SELECT DISTINCT acceptedanswerid FROM posts;
15+
16+ DROP TABLE qn_ans_timing;
17+
18+ CREATE TABLE qn_ans_timing AS
19+ SELECT
20+ p .id ,
21+ p .tags ,
22+ p .owneruserid ,
23+ p .creationdate as qn_creation_ts,
24+ h .creationdate as ans_creation_ts,
25+ p .acceptedanswerid ,
26+ h .userid as answered_by
27+ FROM posts p, posthistory h
28+ WHERE p .acceptedanswerid is not null
29+ AND h .postid in (
30+ SELECT *
31+ FROM accepted_answer_id
32+ )
33+
34+ AND p .acceptedanswerid = h .postid ;
You can’t perform that action at this time.
0 commit comments