public List<Booking> getAllBookings() throws SQLException
    {
        try (Connection con = connector.getConnection())
        {
            String sql = 
            "select CourtBooking.*, [Member/Booking].MemberId"
            + " from CourtBooking"
            + " Left Join [Member/Booking]"
            + " on CourtBooking.Id=[Member/Booking].CourtBookingId";
            
            PreparedStatement ps = con.prepareStatement(sql);
            
            ResultSet rs = ps.executeQuery();
            
            ArrayList<Integer> memberId = new ArrayList();
            ArrayList<Booking> bookings = new ArrayList();
            
            if(!(rs.next()))return null;
            outer:
            while(true)
            {
               int id = rs.getInt("Id");
               int courtid=rs.getInt("CourtId");     
               
               Date sqldate = rs.getDate("DateFrom");
               GregorianCalendar fromDate =  (GregorianCalendar) GregorianCalendar.getInstance();               
               fromDate.setTimeInMillis(sqldate.getTime());
               
               sqldate = rs.getDate("DateTo");
               GregorianCalendar toDate =  (GregorianCalendar) GregorianCalendar.getInstance();               
               toDate.setTimeInMillis(sqldate.getTime());
                       
               memberId.add(rs.getInt("MemberId"));
               
               while(rs.next())
               {
                   
                   if(rs.getInt("Id")==id)
                   {
                       memberId.add(rs.getInt("MemberId"));                       
                   }                       
                   else
                   {
                       bookings.add(Booking.createSimple(id, courtid, fromDate, toDate, memberId));
                       
                       memberId= new ArrayList();
                       
                       continue outer;
                       
                   }
               } 
               break;
            }
            return bookings;
        }
    }