MYSQL - SQL query Getting single record for the similar records and populating other columns with which has more length
Posted
by
Bujji
on Stack Overflow
See other posts from Stack Overflow
or by Bujji
Published on 2011-11-27T01:37:37Z
Indexed on
2011/11/27
1:49 UTC
Read the original article
Hit count: 166
Here is my case , I have a database table with below fields
name
place_code
email
phone
address
details
estd
others
and example data
if you look at the above example table
First three records are talking about XYZ and place code 1020 .
I want create a single record for these three records based on
substring(name,1,4)
place_code
( I am lucky here for all the similar records satisfies this condition and unique in the table .)
For the other columns which record column length has max . For example again for the above 3 records email should be [email protected] , phone should be 657890 and details should be "testdetails"
This should be done for all the table . (Some has single records and some has max 10 records )
Any help on query that helps me to get the desired result ?
Thank You
Regards
Kiran
© Stack Overflow or respective owner