hiling_go/db/queries/reviews.sql
2024-05-22 11:26:15 +07:00

16 lines
323 B
SQL
Executable File

-- 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;