This commit is contained in:
parent
4c59ab3f58
commit
8f2b0470b1
1 changed files with 2 additions and 2 deletions
|
|
@ -339,8 +339,8 @@ func (r *Repo) getZeroPrices(userUuid string) ([]ZeroPrice, error) {
|
|||
WITH price_with_neighbors AS (
|
||||
SELECT
|
||||
p.id, p.created_at, p.merch_uuid, p.price, p.origin, m.name,
|
||||
LAG(price) OVER (PARTITION BY p.merch_uuid ORDER BY p.created_at, p.id) AS prev_price,
|
||||
LEAD(price) OVER (PARTITION BY p.merch_uuid ORDER BY p.created_at, p.id) AS next_price
|
||||
LAG(price) OVER (PARTITION BY p.merch_uuid, p.origin ORDER BY p.created_at, p.id) AS prev_price,
|
||||
LEAD(price) OVER (PARTITION BY p.merch_uuid, p.origin ORDER BY p.created_at, p.id) AS next_price
|
||||
FROM prices AS p
|
||||
JOIN merch as m ON m.merch_uuid = p.merch_uuid
|
||||
WHERE p.deleted_at IS NULL
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue