Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
657 views
in Plugins by

I'm using Noah book creation plugin https://github.com/NoahY/q2a-book as a way to export q2a content as HTML. 

The export does not include by default the unanswered questions, i'm wrapping my head around exporting unanswered questions as well, here is the query generating the answered questions:

$selectspec="SELECT qs.postid AS postid, BINARY qs.title AS title, BINARY qs.content AS content, qs.format AS format, qs.netvotes AS netvotes, BINARY ans.content AS acontent, ans.format AS aformat, ans.userid AS auserid, ans.netvotes AS anetvotes FROM ^posts AS qs, ^posts AS ans WHERE qs.type='Q' AND ans.type='A' AND ans.parentid=qs.postid".($iscats?" AND qs.categoryid=".$cat['categoryid']." ":"").$incsql." ".$sortsql;

and the page where this query is used https://github.com/NoahY/q2a-book/blob/master/qa-plugin.php

Any idea how can i tweek this query to include answerd questions as well.

Thanks a thon in advance 

Q2A version: 1.6.3

1 Answer

+1 vote
by
This should do.

 $selectspec="SELECT qs.postid AS postid, BINARY qs.title AS title, BINARY qs.content AS content, qs.format AS format, qs.netvotes AS netvotes, BINARY ans.content AS acontent, ans.format AS aformat, ans.userid AS auserid, ans.netvotes AS anetvotes FROM ^posts  qs left outer join ^posts  ans on qs.postid=ans.parentid and  ".$anssql." where qs.type='Q' ".($iscats?" AND qs.categoryid=".$cat['categoryid']." ":"") . $incsql." ".$sortsql;
...