Hey 🙂
Assuming this is the client overview, I think this combines expiring domains, asset warranties, asset retirements, and license expiration within the next 90 days (or already expired).
Is there a specific bit you're seeing that isn't accurate/not liking?
--
Domains expiring
SELECT * FROM domains
WHERE domain_client_id = $client_id
AND domain_expire IS NOT NULL
AND domain_archived_at IS NULL
AND domain_expire < CURRENT_DATE + INTERVAL 90 DAY
ORDER BY domain_expire DESC LIMIT 5
Asset warranties expiring
SELECT * FROM assets
WHERE asset_client_id = $client_id
AND asset_warranty_expire IS NOT NULL
AND asset_archived_at IS NULL
AND asset_warranty_expire < CURRENT_DATE + INTERVAL 90 DAY
ORDER BY asset_warranty_expire DESC LIMIT 5
Asset retire
SELECT * FROM assets
WHERE asset_client_id = $client_id
AND asset_install_date IS NOT NULL
AND asset_archived_at IS NULL
AND asset_install_date + INTERVAL 7 YEAR < CURRENT_DATE + INTERVAL 90 DAY
ORDER BY asset_install_date DESC LIMIT 5
Licenses expiring
SELECT * FROM software
WHERE software_client_id = $client_id
AND software_expire IS NOT NULL
AND software_archived_at IS NULL
AND software_expire < CURRENT_DATE + INTERVAL 90 DAY
ORDER BY software_expire DESC LIMIT 5