This sql report is used in a dynamic css file. The css file is a snippet itself. The SQL report returns a random url from a folder (you could use the RandomAsset macro for this useage, if all assets in the folder are images). In the template there should be only the url. The url is then used in the css file. You can create the css file with a snippet. Make sure the snippet has the right mime type (text/css).
The next block is in <div id="dynamic"></div> where the background is difined:
The query is done in 2 steps, so you only need the url of the folder containing the images.
SQL data query1:
SELECT
assetId
FROM
assetData
WHERE
url='media/dynamiccss'
Placeholder parameters query 2
query1:assetId
SQL data query2:
SELECT
assetData.url
FROM
asset,
assetData
WHERE
asset.assetId=assetData.assetId
AND
asset.parentId='FWW6Ouz-CUDsCASPPgzaLw'
ORDER BY
RAND()
LIMIT 1
template:
<tmpl_loop rows_loop><tmpl_loop query2.rows_loop><tmpl_var query2.row.field.url.value><tmpl_var query2.row.number></tmpl_loop></tmpl_loop>
The snippet (text/css) looks like:
#dynamic {
background-image: url(/uploads/mO/jP/mOjPNq_jV7dcnS9-ZMYmvQ/thumb-IMG_1710.jpg);
}
The sql report returns: