mardi 15 septembre 2015

Select with INNER JOIN WHERE ORDERED BY

Is it possible to do all these operations with one request?

Actually it works good except sorting by distance (float, e.g 1.4243453456623).

String query =
                "SELECT * FROM " + ReviewDTO.TABLE_NAME +
                        " INNER JOIN " + RestaurantDTO.TABLE_NAME +
                        " ON REVIEWS.review_user_source=RESTAURANTS.id " +
                        " WHERE " + REVIEW_IS_TRENDING + "=1" +
            " ORDER BY RESTAURANTS.restaurant_distance ASC;";

REVIEW_IS_TRENDING = "review_is_trending";
TABLE_NAME = "RESTAURANTS"
ReviewDTO.TABLE_NAME = "REVIEWS"

For example it returns me restaurants(with test names) in this order(unsorted at all):

Will pin be displayed?

Will pin be displayed?

New 2

New 2

Will pin be displayed?

Will pin be displayed?

Hmhm

Hmhm

Hmhm

New 2

Hmhm

...

Aucun commentaire:

Enregistrer un commentaire