V
V
Valero Afdeev2016-05-19 18:37:31
MySQL
Valero Afdeev, 2016-05-19 18:37:31

Select query displaying the same row from a column multiple times in a row??

Example:
There is a table in it with a column with one value, it needs to be displayed several times in a row
THEN is
| name
| Pavel
It is required to display the same line 5 times in a row as a column using Select
| name
| Pavel
| Pavel
| Pavel
| Pavel
| Pavel
As I understand it, there must be some kind of cycle or how the request should look
Just duplicate the line

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
ThunderCat, 2016-05-19
@ThunderCat

SET @i = 0;
WHILE  @i < 5 
SET @i = @i + 1;
select `name` from `tablename` where `name` = "Павел" 
END

K
Konstantin Tsvetkov, 2016-05-20
@tsklab

Correct answer:

SELECT TOP (5) [table].Name
  FROM [table] CROSS JOIN [table] AS table_5_more_rows
  WHERE ([table].Name = 'Павел')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question