Reputation: 17
I'm trying to select all rows 3 times with different value attached to each one of them, for example:
MyTable:
Name
_____
Tom
John
Result:
Name MyValue
_____ _______
Tom First
Tom Second
Tom Third
John First
John Second
John Third
Anyone knows how to do it with MySQL?
Upvotes: 0
Views: 33
Reputation: 1269783
You can use cross join
:
select t.name, x.which
from t cross join
(select 'First' as which union all
select 'Second' as which union all
select 'Third' as which
) x
Upvotes: 1