[Solved] Mysql - Take data from row and copy it to another row

 
Thread Tools Search this Thread
Homework and Emergencies Emergency UNIX and Linux Support [Solved] Mysql - Take data from row and copy it to another row
# 1  
Old 08-26-2013
[Solved] Mysql - Take data from row and copy it to another row

Sorry if I repost my question in this section, but I'm really in a hurry since I have to finish my work... Smilie

Dear community,
I have a table with two rows like:
Code:
Row1        Row2
=======     =======
7,3         text 1
1,3         text 2
1,2,3       blabla

What i need to do is add/copy all the text from Row1, at the beginning of row2, plus adding some custom text (<br />). Something like:
Code:
Row1        Row2
=======     =======
7,3         7,3<br />text 1
1,3         1,3<br />text 2
1,2,3       1,2,3<br />blabla

So, is there a way to do that using MySQL commands?

Thanks
Lucas
# 2  
Old 08-26-2013
Code:
SELECT row1, CONCAT( row1, '<br />', row2 ) 
  FROM sometable

This User Gave Thanks to Scott For This Post:
# 3  
Old 08-26-2013
Thanks, it works perfect!!!! Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Keep only the closet match of timestamped row (include headers) from file1 to precede file2 row/s

This is a question that is related to one I had last August when I was trying to sort/merge two files by millsecond time column (in this case column 6). The script (below) that helped me last august by RudiC solved the puzzle of sorting/merging two files by time, except it gets lost when the... (0 Replies)
Discussion started by: aachave1
0 Replies

2. Shell Programming and Scripting

Splitting single row into multiple rows based on for every 10 digits of last field of the row

Hi ALL, We have requirement in a file, i have multiple rows. Example below: Input file rows 01,1,102319,0,0,70,26,U,1,331,000000113200000011920000001212 01,1,102319,0,1,80,20,U,1,241,00000059420000006021 I need my output file should be as mentioned below. Last field should split for... (4 Replies)
Discussion started by: kotra
4 Replies

3. UNIX for Beginners Questions & Answers

Keep only the closet match of timestamped row (include headers) from file1 to precede file2 row/s

My original files are like this below and I distinguish them from the AP_ID (file1 has 572 and file2 has 544). Also, the header on file1 has “G_” pre-pended. NOTE: these are only snippets of very large files and much of the data is not present here. Original File 1: ... (36 Replies)
Discussion started by: aachave1
36 Replies

4. Shell Programming and Scripting

Add Row from First Row (Split Row)

HI Guys, I have Below Input :- RepigA_hteis522 ReptCfiEtrBsCll_aofe MSL04_MSL2_A25_1A 0 9 MSL04_MSL2_A25_1B 0 9 MSL04_MSL2_A25_1C 0 9 RepigA ReptCfiEtrBsCll hteis522 aofe MSL04_MSL2_A25_1A 0 9 MSL04_MSL2_A25_1B 0 9 MSL04_MSL2_A25_1C 0 9 Split Data in two first row... (2 Replies)
Discussion started by: pareshkp
2 Replies

5. UNIX for Dummies Questions & Answers

Shell Script: Traverse Database Table Row by Row

Hello Everyone, My issue is that I want to traverse a database table row by row and do some action on the value retrieved in each row. I have gone through a lot of shell script questions/posts. I could find row by row traversal of a file but not a database table. Please help. Thanks &... (5 Replies)
Discussion started by: ahsan.asghar
5 Replies

6. Shell Programming and Scripting

Moving data from a specified column/row to another column/row

Hello, I have an input file like the following: 11_3_4 2_1_35 3_15__ _16989 Where '_' is a space. The data is in a table. Is there a way for the program to prompt the user for x1,y1 and x2,y2, where x1,y1 is the desired number (for example x=6 y=4 is a value of 4) and move to a desired spot... (2 Replies)
Discussion started by: jl487
2 Replies

7. Shell Programming and Scripting

Add value of each row when each row has different data ype

Guys -- I am noob and I am really strugging on this one. I cant even write the pseudo code for it. I have a file that spits values in individual rows as such: file: user date type size joe 2005-25-09 log 1 joe 2005-25-09 snd 10 joe 2005-25-09 rcd 12 joe 2005-24-09 log 2 joe... (1 Reply)
Discussion started by: made2last
1 Replies

8. Shell Programming and Scripting

How to insert data befor some field in a row of data depending up on values in row

Hi I need to do some thing like "find and insert before that " in a file which contains many records. This will be clear with the following example. The original data record should be some thing like this 60119827 RTMS_LOCATION_CDR INSTANT_POSITION_QUERY 1236574686123083rtmssrv7 ... (8 Replies)
Discussion started by: aemunathan
8 Replies

9. Shell Programming and Scripting

Changing the column for a row in a text file and adding another row

Hi, I want to write a shell script which increments a particular column in a row from a text file and then adds another row below the current row with the incremented value . For Eg . if the input file has a row : abc xyz lmn 89 lm nk o p I would like the script to create something like... (9 Replies)
Discussion started by: aYankeeFan
9 Replies
Login or Register to Ask a Question