1

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?

2 Answers 2

5

Use the following if you want to execute myFuncFoo() for every row:

SELECT users.id,
myFuncFoo(users.id)
FROM users;
Sign up to request clarification or add additional context in comments.

Comments

1
select myFuncFoo(uid) from(select uid from users where uid=1);

2 Comments

Please explain your answer.
select uid,myFunFoo(uid) from users

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.