Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Query in CQL
(defn user-feedback [user-id]
(-> (select users (where (= :users.id user-id)))
(join items (where (= :items.user_id :users.id)))
(join reservations (where (or (= :renter :users.id)
(= :item :items.id))))
(join feedback (where (= :reservation :reservations.id)))
distinct
(project [:feedback.id :feedback.reservation :feedback.score :feedback.sender :feedback.comment])))
SELECT DISTINCT feedback.id,feedback.reservation,feedback.score,feedback.sender,feedback.comment FROM users JOIN items ON (items.user_id = users.id) JOIN reservations ON ((renter = users.id) OR (item = items.id)) JOIN feedback ON (reservation = reservations.id) WHERE (users.id = 16)
SELECT DISTINCT feedback.id,feedback.reservation,feedback.score,feedback.sender,feedback.comment FROM users JOIN reservations ON ((renter = users.id) OR (item = items.id)) JOIN items ON (items.user_id = users.id) JOIN feedback ON (reservation = reservations.id) WHERE (users.id = 16)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.