Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String email = Main_Login.accounttext.getText().trim();
- statement = (PreparedStatement) con
- .prepareStatement(""
- + "SELECT FILM,(film_total_ratings/number_of_ratings) as ratings_rating "
- + "FROM( "
- + "SELECT COUNT(*) as number_of_ratings, FILM, "
- + " SUM(RATING) as film_total_ratings "
- + " FROM ratings GROUP BY film "
- + "ORDER BY rating DESC"
- + ") TMP_Film");
- result = (ResultSet) statement.executeQuery();
- int i = 0;
- while (result.next() && i <= 4) {
- i++;
- // if (result.getString(1).contains(email)) {
- System.out.println((i) + ")" + " " + "[Movies You Might Like]"
- + " " + result.getString(1) + " " + "[Rating]" + " "
- + result.getString(2));
- statement = (PreparedStatement) con
- .prepareStatement(""
- + "SELECT FILM,(film_total_ratings/number_of_ratings) as ratings_rating "
- + "FROM( "
- + "SELECT COUNT(*) as number_of_ratings, FILM, "
- + " SUM(RATING) as film_total_ratings, "
- + " SUM(CASE WHEN EMAIL LIKE '%"+email+"%' THEN 1 ELSE 0 END) as rated"
- + " FROM ratings GROUP BY film HAVING rated=0 "
- + "ORDER BY rating DESC"
- + ") TMP_Film");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement