0

How to use the user defined variable in a way that the value of the variable is reused in the subsequent query in mysql?

2
  • would this be inside a stored procedure? Commented Jul 10, 2009 at 8:22
  • no . i dont want it in stored prodcure Commented Jul 10, 2009 at 8:37

1 Answer 1

1

Just use it:

SELECT  @r := 1

---
  1

SELECT  @r := @r + 1

---
  2
Sign up to request clarification or add additional context in comments.

Comments

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.