1
It is possible to make a query (SELECT) of data returned from a column such as columns?
select questores from table;
| coluna | → coluna
|-------------|
| dado1 | → dados retornados da consulta
| dado2 |
| dado3 |
Ex: This row below would be data returned from a column query:
How could I ever return dice as columns in this way
|dado1| dado2 | dado3|
----------------------
The idea is to return the data of this spine as columns and then make a assign data to those columns that were generated by the query represented as data. At the end would be something like this and export them to a spreadsheet in this format:
|dado1 | dado2 | dado3 | → colunas
------------------------
|valor1| valor1 | valor1| → dados de alguma outra consulta
|valor2| valor2 | valor2|
|valor3| valor3 | valor3|
You want to select the table structure?
– Costamilam
Possible duplicate of How to get column names from a table in SQL Server?
– Marconi
Good evening Brendow Adriel! There is no way to do this directly with the SQL query. To put the query data as columns, you need to make the normal query and treat it a font-end
– Bruno Maciel
Brendow, you need to use a programming language to mount an array with the values of this query and print these values in a front-end table.
– Hugo Guitti
research on
pivot
and that depends a lot on which database you’re using. Perhaps an easier way would be to mount the query with multiple sub-selects at runtime. Anyway, the question does not bring enough details to elaborate an answer– Rovann Linhalis
I want to get the values of a column selected as columns.
– Brendow Adriel
@Brendowadriel Avoid so expressively changing the content of your question, it causes a lot of confusion and makes it difficult to get a more precise answer.
– Lacobus
@Brunomaciel, it is possible yes, but it depends.
– David
Which database do you use (SGDB)? Are the data fixed or dynamic? Do you already know how to do the export to Excel part? How?
– David
I am currently using Mysql. From this specific table are physical data, it is a table of questions. Exporting to xsl or csv is no problem, problem is selecting the data in this format in the database query.
– Brendow Adriel