Refactor SQL creation

* Break plots "select" clause into "fields" and "tables"
* In config, combine "plots" properties under "sqlForPlots" and include more pieces of the final SQL
* Fix up tests
* Add makeSql.js as separate module

Note also a bug fix: sqlForPlots.tables.tree now does a LEFT JOIN on the species table instead of a JOIN. That's because when searching for trees we want to get trees without species. With JOIN (aka INNER JOIN) we wouldn't.