15 lines
695 B
SQL
15 lines
695 B
SQL
SELECT
|
|
'finished-timed-gift' AS giftType,
|
|
CAST(gift.user_profile_id AS TEXT) || ':' || CAST(gift.map_id AS TEXT) || ':' || CAST(gift.spawn_time AS TEXT) AS giftId,
|
|
CAST(gift.user_profile_id AS TEXT) AS userProfileId,
|
|
CAST(gift.map_id AS TEXT) AS mapId,
|
|
gift.spawn_time AS spawnTime,
|
|
datetime(gift.spawn_time, 'unixepoch') AS spawnAt,
|
|
COALESCE(profile.name, user.name, '') AS displayName
|
|
FROM finished_timed_gift_spawner gift
|
|
LEFT JOIN user_profile profile ON profile.id = gift.user_profile_id
|
|
LEFT JOIN user ON user.id = profile.user_id
|
|
WHERE (:userProfileId IS NULL OR CAST(gift.user_profile_id AS TEXT) = :userProfileId)
|
|
ORDER BY gift.spawn_time DESC
|
|
LIMIT COALESCE(:limit, 500)
|