MySQL Forums
Forum List  »  Newbie

Update different tables
Posted by: miguel rivero
Date: September 01, 2017 03:27AM

Hi all, I need your help.

This is my table_start on MySQL database :

+--------+---------+-----------+
| userID | userTfc | userCount |
+--------+---------+-----------+
| 11655  | SN10    |        45 |
| 11655  | SN16    |        80 |
| 11655  | SN24    |       796 |
| 11655  | SN35    |        56 |
+--------+---------+-----------+

I need update the table_end on the same MySQL database in this mode :

+--------+------------+------------------+------------+------------------+------------+------------------+------------+------------------+
| userID | userTfc_01 | userTfc_01_Count | userTfc_02 | userTfc_02_Count | userTfc_03 | userTfc_03_Count | userTfc_04 | userTfc_04_Count |
+--------+------------+------------------+------------+------------------+------------+------------------+------------+------------------+
| 11655  | SN10       | 45               | SN16       | 80               | SN24       | 796              | SN35       | 56               |
+--------+------------+------------------+------------+------------------+------------+------------------+------------+------------------+

For the same userID I need update :

1) the first value of table_start column userTfc to column userTfc_01 of table_end;
2) the first value of table_start column userCount to column userTfc_01_Count of table_end;

3) the second value of table_start column userTfc to column userTfc_02 of table_end;
4) the second value of table_start column userCount to column userTfc_02_Count of table_end;

5) the third value of table_start column userTfc to column userTfc_03 of table_end;
6) the third value of table_start column userCount to column userTfc_03_Count of table_end;

7) the fourth value of table_start column userTfc to column userTfc_04 of table_end;
8) the fourth value of table_start column userCount to column userTfc_04_Count of table_end;

Can you help me?

Thank you in advance for any help, really appreciated.

Options: ReplyQuote


Subject
Written By
Posted
Update different tables
September 01, 2017 03:27AM
September 01, 2017 10:01AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.