Now need through customer address (all over the country provinces and cities have), the distribution of statistical customer,
Current customers address dress field are the following format:
In wuxi city, jiangsu province... Or: jiangsu yancheng,,,
So now consider is, statistics the number of strings containing the provinces, the statement how to write? Or is there a better way, for high efficiency, because the data has more than 20, ten thousand,
CodePudding user response:
It is a long story, for example, it is recommended that the change table structure,SELECT * FROM (
SELECT 'in wuxi city, jiangsu province' D FROM DUAL UNION ALL
SELECT the FROM DUAL) 'in urumqi, xinjiang' D T WHERE INSTR (D, 'jiangsu) & gt; 0
CodePudding user response:
It's quite simple, technical statement, surely you'll write,Actual scene first consider the use frequency,
If only a little check, just like a query,
If use more, suggest or two new fields: province, city, the basic data processing first,