0
在我的MySQL表中,我有一個專欄 - Residence_Address1。但它也有其他專欄的價值。我想從現場提取電子郵件ID。從在mysql中有多個單詞的字段中提取電子郵件
示例數據。
例如,
[email protected],[email protected],cityname
cityname,zipcode,[email protected]
[email protected],cityname,[email protected]
apartment,streetname,cityname,[email protected],[email protected]
如果我試着這樣說:
select
concat(trim(substring_index(substring_index(ResidenceAddress1, '@', '1'), ' ', -1)), '@gmail.com') as mail
,ResidenceAddress1
from mytable
1)合併這樣的數據。輸出: [email protected]
代替[email protected]
2)與address.Output一起獲取電子郵件:apartment,streetname,cityname,[email protected]
相反[email protected]從一排。
我試過這種方式。
select concat(substring_index((substring_index(Residence_Address1, '@', 2)),'@gmail',1),'@gmail.com') as mail, residence_address1
from mytable
where Residence_Address1!="" and Residence_Address1 like '%gmail%'
1)它沒有合併像yahoo id和gmail id這樣的記錄。
2)但它提供了完整的地址以及電子郵件ID。
eg.streetname,cityname,gmailid。
上面的嘗試主要是獲取gmail ids.而不是隻抓取gmail id,我想從一行中提取所有電子郵件。只有電子郵件。
謝謝。有我的錯誤。 –
哦,如果我們從記錄中提取雅虎ID,雅虎ID就像atyahoo.com和atyahoo.co.in,它將無法正常工作。在這裏,我們使用所有的id追加.com,即使它的.com或.co.in。 –
@iks_in我已更新我的答案,請檢查它。 – Blank