Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.3 kB
3
Indexable
SELECT 
    FORMATDATE(
        CASE 
            WHEN DAYOFWEEK(NOW()) = 6 THEN NOW()
            ELSE DATEADD('d', 6 - DAYOFWEEK(NOW()), NOW())
        END,
        'MM/DD/YYYY'
    ) AS 'Friday',
    FORMATDATE(
        DATEADD('d', 7, 
            CASE 
                WHEN DAYOFWEEK(NOW()) = 6 THEN NOW()
                ELSE DATEADD('d', 6 - DAYOFWEEK(NOW()), NOW())
            END
        ),
        'MM/DD/YYYY'
    ) AS 'Next Friday',
    FORMATDATE(
        DATEADD('d', 14, 
            CASE 
                WHEN DAYOFWEEK(NOW()) = 6 THEN NOW()
                ELSE DATEADD('d', 6 - DAYOFWEEK(NOW()), NOW())
            END
        ),
        'MM/DD/YYYY'
    ) AS 'Friday + 2 Weeks',
    FORMATDATE(
        DATEADD('d', 21, 
            CASE 
                WHEN DAYOFWEEK(NOW()) = 6 THEN NOW()
                ELSE DATEADD('d', 6 - DAYOFWEEK(NOW()), NOW())
            END
        ),
        'MM/DD/YYYY'
    ) AS 'Friday + 3 Weeks',
    FORMATDATE(
        DATEADD('d', 28, 
            CASE 
                WHEN DAYOFWEEK(NOW()) = 6 THEN NOW()
                ELSE DATEADD('d', 6 - DAYOFWEEK(NOW()), NOW())
            END
        ),
        'MM/DD/YYYY'
    ) AS 'Friday + 4 Weeks'
FROM T*