如何选择电话号码的起始3位数? [英] how to select starting 3 digit of a phone number?
本文介绍了如何选择电话号码的起始3位数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嘿伙计们
我正在进行一个项目,我必须下载已排序的数据
我必须对数据进行排序电话号码的起始位置为3位数。
SELECT *来自表子,其中substring(phone_number,1,3)='256';
请解决此查询中是否有任何错误或告诉我查询开始3位数。
提前谢谢你
Hey guys
I m working on a project where i have to download the sorted data
I have to sort the data on basis of phone number's starting 3 digit.
SELECT * from table where substring(phone_number, 1, 3)='256';
please resolve if there is any error in this query or tell me the query to get starting 3 digit.
Thank u in advance
推荐答案
您的示例不对数据进行排序,它只选择具有以256开头的phone_number的记录。
使用ORDER BY子句对结果进行排序数据。
SELECT *来自表ORDER BY子串(phone_number,1,3);
或
SELECT *来自表ORDER BY Left(phone_number,3);
Your example does not sort the data it only selects records that have phone_number starting with 256.
Use ORDER BY clause to sort the resulting data.
SELECT * from table ORDER BY substring(phone_number, 1, 3);
Or
SELECT * from table ORDER BY Left(phone_number, 3);
这篇关于如何选择电话号码的起始3位数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文