Reputation: 95
I have the following requirement as per the screenshot attached.
I need a Dynamic date in the FROM table name in a scheduled Query so each day it will populate yesterdays data.
Upvotes: 0
Views: 292
Reputation: 71
I don't use sharded tables anymore, so I'm not sure if this is the most up to date solution. Some time ago you could do this way:
EXECUTE IMMEDIATE CONCAT('select count(1) from `', "xxscore-prod.analytics_229726387.events_20201114", '`');
This way you can freely construct the table's suffix and replace the date as you wish
Upvotes: 0