Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select
- @first:=SUBSTRING_INDEX(combinations,',',1) as first,
- @second:=substring_index(SUBSTRING_INDEX(combinations,',',2), ',', -1) as second,
- @third:=substring_index(SUBSTRING_INDEX(combinations,',',3), ',', -1) as third,
- @forth:=substring_index(SUBSTRING_INDEX(combinations,',',4), ',', -1) as forth,
- @fifth:=substring_index(SUBSTRING_INDEX(combinations,',',5), ',', -1) as fifth,
- @sixth:=SUBSTRING_INDEX(combinations,',',-1) as sixth,
- @suma:=@first+@second+@third+@forth+@fifth+@sixth as suma
- from All_combinations limit 10;
- +-------+--------+-------+-------+-------+-------+------+
- | first | second | third | forth | fifth | sixth | suma |
- +-------+--------+-------+-------+-------+-------+------+
- | 1 | 2 | 3 | 4 | 5 | 6 | 21 |
- | 1 | 2 | 3 | 4 | 5 | 7 | 22 |
- | 1 | 2 | 3 | 4 | 5 | 8 | 23 |
- | 1 | 2 | 3 | 4 | 5 | 9 | 24 |
- | 1 | 2 | 3 | 4 | 5 | 10 | 25 |
- | 1 | 2 | 3 | 4 | 5 | 11 | 26 |
- | 1 | 2 | 3 | 4 | 5 | 12 | 27 |
- | 1 | 2 | 3 | 4 | 5 | 13 | 28 |
- | 1 | 2 | 3 | 4 | 5 | 14 | 29 |
- | 1 | 2 | 3 | 4 | 5 | 15 | 30 |
- +-------+--------+-------+-------+-------+-------+------+
- 10 rows in set (0.00 sec)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement