0

I'm trying to input a set of userIDs to output one variable from multiple userIDs but only the most recent 30 values of each. Do I need to add a loop within a subquery to limit to 30? Any help is appreciated!

Thank you!

'''

DEFINE MACRO userid
  
  '123abc',
  '321cba',
  '987zyx'
  ;

SELECT purchases
FROM random.database
WHERE person = $userid
ORDER BY most_recent_purchases DESC
LIMIT 30 // This is wrong :(

'''

0 Answers0