我這樣寫為什么結果不對?
找了半天,也不知道哪兒出錯了,大牛們,幫我看看啊,主要是a.id=2時,數據為空
select user_name,
?? ?replace(
?? ?substring(substring_index(mobile, ',', a.id),char_length(substring_index(mobile, ',', a.id-1)) + 1),',','') as mobile
from tb_sequence a
??? cross join (
?? ??? ?select
?? ??? ??? ?user_name,
??????????? concat(mobile,',') as mobile,
??????????? length(mobile) - length(replace(mobile,',', ''))+1 size
?? ??? ?from user1 b
??? ) b on a.id <= b.size;
2017-01-10
不清楚你的表結構是什么,所以很難去說哪里出錯了。但是用數據庫最好還是少用函數,這樣的話性能會大大的提高,盡量把函數的方法用代碼解決
2017-07-05
sql語句是對的