accept arrays in where and from clause; don't list column aliases in count

For dynamic SQL creation it's useful to use arrays in where and from clauses. Also I fixed a bug which occurs if count and column aliases are combined. The commits contain tests for all changes.