Reputation: 155
I have a function that will take a user's id as a parameter and do stuff using that parameter. I would like to call that function for several users.
For a single user I successfully use:
SELECT myFuncFoo(1);
And for multiple users I tried this without luck:
SELECT users.id as uid,
(SELECT myFuncFoo(uid))
FROM users;
I also tried without aliases:
SELECT users.id,
(SELECT myFuncFoo(users.id))
FROM users;
How can I achieve this?
Upvotes: 1
Views: 2751
Reputation: 12798
Use the following if you want to execute myFuncFoo()
for every row:
SELECT users.id,
myFuncFoo(users.id)
FROM users;
Upvotes: 5