13 lines
257 B
SQL
13 lines
257 B
SQL
SELECT buy_order_id
|
|
FROM buy_orders
|
|
JOIN cards
|
|
ON buy_orders.title = cards.title
|
|
WHERE title == desired_title
|
|
AND price >= desired_price
|
|
AND volume > (
|
|
SELECT count(*)
|
|
FROM transactions
|
|
WHERE buy_order_id == buy_order_id;
|
|
)
|
|
ORDER BY price DESC;
|