473,379 Members | 1,330 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

concatenating two fields and storing the value in a single field using mysql

plz help me solving the problem.


i am using a table named XYZ in MYSQL
i have columns A B C D E

now i want 2 concatenate the values of column A & B and store this value in column A, such that new values in column A is concatenation of values of A + values of B.
plz sumone help me in writing query
Jul 17 '06 #1
5 8278
Banfa
9,065 Expert Mod 8TB
Have you tried

UPDATE XYZ SET A=A+B

not that I am a database expert so take a backup of your database FIRST!
Jul 17 '06 #2
xpcer
51
I think, it depends of the data type of the field.
If the data type is numeric you can use aritmatic operation such as A+B, but if you use another data type such as varchar u can use CAST or CONVERT function that available in mysql.

Can u tell me what data type you choose for the field, may be i can help you.
Jul 18 '06 #3
plz help me solving the problem.


i am using a table named XYZ in MYSQL
i have columns A B C D E

now i want 2 concatenate the values of column A & B and store this value in column A, such that new values in column A is concatenation of values of A + values of B.
plz sumone help me in writing query
Solution::

select concat(A,' ',B) as A from XYZ ;

If you want to see separate values in column A then

select concat(A,' , ',B) as A from XYZ ;

Hope this solve ur problem.
Nov 30 '06 #4
May be you should try This:

Update Tablename set A=(SELECT CONCAT('value of column A', 'value of column B')) where condition...;
Nov 30 '06 #5
jepler
4
>>>
Solution::

select concat(A,' ',B) as A from XYZ ;

If you want to see separate values in column A then

select concat(A,' , ',B) as A from XYZ ;

Hope this solve ur problem.

I don't know if it solved his problem, but it solved mine!! Thank you!!!!
Jan 5 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Jason | last post by:
Let's say I have an html form with 20 or 30 fields in it. The form submits the fields via POST to a php page which updates a table in a database with the $_POST vars. Which makes more sense? ...
3
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a...
7
by: Charles Crume | last post by:
Hello all; I have used dBASE, and other computer languages/databases, for years. They all have a logical field type. However, the version of MySQL used by the ISP hosting my site does not...
5
by: ND | last post by:
I need to create a separate field from 4 fields, "street address", "city", "State" and "zip code". For example, Street address - 100 Forest Street City - Seattle State - WA Zip - 05555 ...
3
by: google | last post by:
I have a database with four table. In one of the tables, I use about five lookup fields to get populate their dropdown list. I have read that lookup fields are really bad and may cause problems...
16
by: Dixie | last post by:
I have a problem using Dev Ashish's excellent module to concatenate the results of a field from several records into one record. I am using the code to concatenate certain awards onto a...
4
by: Larry | last post by:
OK, I'm just learning MySQL, or at least trying to. I have a table with data as follows USER FIELDID VALUE 1 1 Bob 1 2 Smith 2 1 John 2 ...
2
by: steph | last post by:
I have a table with 250 fields. Of course you are wondering why 250 fields... what could I possibly be storing in so many fields? I am using this table as a general import table for files that...
2
by: Whizzo | last post by:
Hi all; I'm using this great bit of code to concatenate a fields from multiple rows into a single one. 'Concat Returns lists of items which are within a grouped field Public Function...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.