I have a simple query:
SELECT COUNT(ud.UserID), COUNT(DISTINCT ud.ProductID)
FROM users_data AS ud
JOIN products AS t ON t.ID = ud.ProductID
WHERE ud.UserID = '3'
Which results in:
COUNT(ud.UserID) COUNT(DISTINCT ud.ProductID)
519 425
When I try to include in a while or for loop:
DELIMITER //
SET @i = 0;
FOR i IN 1..10
DO SELECT COUNT(ud.UserID), COUNT(DISTINCT ud.ProductID)
FROM users_data AS ud
JOIN products AS t ON t.ID = ud.ProductID
WHERE ud.UserID = (i)
END FOR
//
I get no output other than:
Query executed OK, 0 rows affected.
Is there something else I'm misssing? thank you.