Is it possible to do something like this (obviously this syntax does not work):
SELECT a FROM (1, 2, 3)
to get this:
| a |
+---+
| 1 |
| 2 |
| 3 |
?
That is I want to make rows from coma separated list, without using any table, or at least without creating table in db (maybe this is possible using something like temporary table?).
Maybe it is possible to get column of given values without using select, that is using some other sql statment? If it is not possible in MySQL, but possible in some other SQL it still would be interesting to know.
In MySQL, you can return your query results as a comma separated list by using the GROUP_CONCAT() function. The GROUP_CONCAT() function was built specifically for the purpose of concatenating a query's result set into a list separated by either a comma, or a delimiter of your choice.
How do I get comma separated values in SQL Server? In order to fetch the comma separated (delimited) values from the Stored Procedure, you need to make use of a variable with data type and size same as the Output parameter and pass it as Output parameter using OUTPUT keyword.
How can I get multiple row values in comma separated in MySQL? MySQL. MySQL has the GROUP_CONCAT() function that allows us to output our query results in a comma separated list: SELECT GROUP_CONCAT(PetName) FROM Pets; Oracle Database.
SELECT 1 a UNION ALL SELECT 2 a UNION ALL SELECT 3 a;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With