1
だから、基本的に私はこの効果、任意の提案を達成する必要がありますか?PostgreSQLの結合でCase Statementを使用するにはどうすればよいですか?
JOIN ((CASE WHEN (SELECT COUNT(e.order_id) FROM entry ee WHERE ee.order_id = o.id) > 1
THEN (SELECT * FROM entry e WHERE e.user_id = 3)
ELSE (SELECT * FROM entry e WHERE e.user_id = 3 AND e.draw_id = (SELECT dd.id
FROM draw dd
WHERE dd.draw_date_time > CURRENT_TIMESTAMP(0)
ORDER BY dd.draw_date_time ASC
LIMIT 1))
END) e ON e.order_id = o.id