Looping,Array On Procedure MYSQL

5 pts.
Tags:
MySQL
MySQL Stored Procedures
For All IT I have Data string "123". How to create procedure (MySQL) for string "123" to Be : 1. 123 2. 132 3. 231 4. 213 5. 312 6. 321 Point 1-6 is array. Please Help Me an Thanks Thanksss

Answer Wiki

Thanks. We'll let you know when a new response is added.

<pre>SELECT comb
FROM (

SELECT model, concat( substring( model, a, 1 ) , substring( model, b, 1 ) , substring( model, c, 1 ) ) comb
FROM (

SELECT ’123′ AS model
)X
CROSS JOIN (

SELECT 1 a
UNION ALL SELECT 2
UNION ALL SELECT 3
)fst
CROSS JOIN (

SELECT 1 b
UNION ALL SELECT 2
UNION ALL SELECT 3
)snd
CROSS JOIN (

SELECT 1 c
UNION ALL SELECT 2
UNION ALL SELECT 3
)trd
WHERE a <> b
AND (
c <> a
AND c <> b
)
)x
GROUP BY model, comb</pre>

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following