query = "SELECT RATINGS_USERS, STORY.STORY_ID, STORY_TITLE, STORY_DATE, STORY_LAT, STORY_LNG, USER_USERNAME from STORY, USER LEFT OUTER JOIN RATINGS ON RATINGS.STORY_ID = STORY.STORY_ID WHERE STORY.USER_ID=USER.USER_ID AND STORY_PUBLIC=1 AND STORY_LAT < ? AND STORY_LAT > ? AND STORY_LNG < ? AND STORY_LNG > ? ORDER BY STORY.STORY_ID DESC LIMIT ?,7"; statement = connection.prepareStatement(query); statement.setDouble(1, northEastLat); statement.setDouble(2, southWestLat); statement.setDouble(3, northEastLng); statement.setDouble(4, southWestLng); statement.setInt(5, (set * 7));