M
M
mantovpinets2018-01-29 10:39:02
MySQL
mantovpinets, 2018-01-29 10:39:02

How to select all fields from a table, but assign an alias to one field?

Hello.
Faced such a problem. From the table, you need to get all the fields and all the values ​​\u200b\u200bof the fields, but assign an alias to one field. How to do it?
I tried this: But I only select the id, name field and the value goes as a separate field with the same value as the name value.
SELECT *, name AS value FROM table

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Y
Yerlan Ibraev, 2018-01-29
@mad_nazgul

SELECT ID, NAME AS VALUE FROM TABLE?!

R
Rinat Gilmanov, 2018-01-29
@RinatG

"select * from" is better not to use. no orm generates such requests. you need to choose no more than the required amount of data. therefore Yerlan's answer is final.

K
Konstantin Tsvetkov, 2018-01-29
@tsklab

Are there no synonyms in MySQL?

CREATE SYNONYM [dbo].[Place] FOR [Videoteq].[dbo].[Storage]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question