hiling_go/db/queries/reviews.sql

16 lines
323 B
MySQL
Raw Permalink Normal View History

-- name: CheckIfReviewExists :one
SELECT COUNT(1)
FROM reviews
WHERE reviews.location_id = $1 AND reviews.submitted_by = $2;
-- name: GetUserReviewByLocation :one
SELECT
re.id,
re.location_id,
re.score,
re.comments,
re.created_at,
re.updated_at
FROM reviews re
WHERE submitted_by = $1 AND location_id = $2;