very basic SQL ASQ query generator