请帮助我... Mysql Php ........ [英] Please Help Me ... Mysql Php ........
问题描述
大家好
考虑一个表名,PERSONS字段是p_id,p_name,p_area_code_p_phone.
p_id,p_name,p_area_code和p_phone. p_state
1 Shiana 00178 0002258965旁遮普省
2 Mandeep 00156 0000221996旁遮普省
3 Mehak 00159 0002218114 himachal
4 Rohit 00269 0000221206拉贾斯坦邦
5拉曼45285 2589994566旁遮普省
现在看看p_area_code和p_phone号码
1.我需要在一个字段p_phone中将p_area_code和p_phone的值连接起来
2.我需要删除所有前导零(如果有),其中p_country等于旁遮普语.
Hi all
Consider a table name PERSONS fields are p_id,p_name,p_area_code_p_phone.
p_id, p_name p_area_code p_phone. p_state
1 Shiana 00178 0002258965 punjab
2 Mandeep 00156 0000221996 punjab
3 Mehak 00159 0002218114 himachal
4 Rohit 00269 0000221206 Rajasthan
5 Raman 45285 2589994566 punjab
Now look at p_area_code and p_phone number
1. I need to concatenate the values of p_area_code and p_phone in one field which is p_phone
2.I need to remove all leading zero''s(if any) where p_country is equal to punjab.
推荐答案
假设两个都存储为字符串-
select CONCAT( p_area_code,p_phone) as p_phone
.
如果它们都存储为数字,则需要使用CONVERT
函数将这些数字另外转换为字符串.
Assuming both are stored as string -
select CONCAT( p_area_code,p_phone) as p_phone
.
If they are both stored as numbers then you will need to additionally convert these numbers to strings use theCONVERT
function.
这篇关于请帮助我... Mysql Php ........的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!