BEGIN;
DROP TABLE latest_33_files;
SELECT 
    file.id,
    file.description,
    file.filename_lowres
INTO 
    TABLE latest_33_files
FROM
    file
INNER JOIN 
    account ON file.setupaccountid = account.accountid
WHERE
    file.deleted = false
AND
    file.isprivate = false
AND
    account.accountactive = true
AND
    NOT file.filecategoryid IS NULL
ORDER BY
    setupdate desc NULLS LAST
LIMIT
    33;
COMMIT;
