public ArrayList<TicketVO> selectQuery(HashMap<String, String[]> requestMap) {

		ArrayList<TicketVO> ticketList = new ArrayList<TicketVO>();

		PreparedStatement ps = null;
		ResultSet rs = null;
		try {

			this.getConnection();

			// build SQL query
			ticketBuild = new TicketBuilder(requestMap);
			String ticketQuery = ticketBuild.buildQuery();

			log.debug(ticketBuild.getSqlColumnNames().toString());
			ps = conn.prepareStatement(ticketQuery);

			// prepare query before executing
			this.prepareQuery(ps, ticketBuild.getSqlColumnNames(), requestMap);
			rs = ps.executeQuery();
			
			//build list of Tickets
			int count = 0;
			int ticketNo = 0;
			TicketVO tvo = null;
			while(rs.next()) {
				
			ticketNo = rs.getInt("mbt.id");

				if(count != ticketNo){
					//add to list
					if(tvo != null) ticketList.add(tvo);
					//create a new vo
					tvo = new TicketVO(rs);
				}else{
					//add additional data to previous ticket vo
					tvo.getCustomFields().put(rs.getString("customNames"),
							rs.getString("cfs.value"));
				}
				//set count to previous ticket number
				count = ticketNo;
			}
			ticketList.add(tvo);
			log.debug(ticketList.toString());
			
		} catch (SQLException e) {
			e.printStackTrace();
		} finally {
			if (conn != null)
				this.closeConnection();
			if (ps != null) {
				try {
					ps.close();

				} catch (SQLException e) {
					e.printStackTrace();
				}
			}
		}
		
		//sort the list
		Collections.sort(ticketList);
		
		log.debug(ticketList.toString());	
		return ticketList;

	}