public String generateSELECT(
		Collection<String> what, Collection<String> from, String criteria, 
		String orderBy, boolean desc, int limit) {

		String limitStm = "";
		String orderByStm = "";

		if (limit > 0) limitStm = " LIMIT  " + limit;

		if (orderBy != null) {
			orderByStm += " ORDER BY " + orderBy;
			orderByStm += desc ? " DESC " : " ASC ";
		}
		
		String query = "SELECT ";

		boolean first = true;
		for (String tN : what) {
			query += first ? "" + tN + ".*" : "," + tN +".*";
			first = false;
		}	
		
		query += " FROM ";
		
		first = true;
		/* The tables specified in FROM */
		for (String table : from) {
			query += first ? "" + table : "," + table;
			first = false;
		}
		
		query += " WHERE " + criteria + orderByStm + limitStm;
		
		//System.out.println(query);
		
		return query;
	}