mysql - Join two rows Distinctly -


If I have a table that

  number 1 2 3 4 5 6 7 8 9  

And I want to display the same table in two columns

  SELECT t1.num, t2.num FROM (SELECT * FROM x ) AS T1, (SELECT * FROM x) AS T2  

Then the result set appears

  Number 1,1 2,2,3, 3,4,4,5,5,6,6,7,7,8,8 9  

How do I do this in MySQL

Edit

Sorry, I did not want to make things complicated to start with: But this What is trying to do in the present

To make a bit more clear, what is actually trying to do?

  num 1,2 2,3 3 , 4,5,5,6,6,7,8,8 9 / <>  

Do I want to be able to forward:

  SELECT t2 Note that the above query will return all 1s but the values ​​in my database are appearing individually above   

Thanks in advance

I do not understand Why do not you just do something simple:

  SELECT num as num1, num x to  

or if you really want it As a string:

  SELECT CONCAT (num, ',', num) x to num x  

If you select twice the table You can join the table with you, but I do not know why you want to do this:

  Selection Concat (T. 2 NNM) X AS T1 JOIN X AS T2 ON from SX NX Mr. 1 ANM = T2. NAM  

will be more intuitive if you need fields from different rows, like '1,2', '2,3', etc. ... when you make your question So maybe you have some exaggerated things? Are you just trying to learn how to get involved in syntax?


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -