在表格中搜索关键字 [英] search for keyword in table

查看:103
本文介绍了在表格中搜索关键字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个列有一些列的表,其中一列是电话号码。


所以,如果我想计算电话号码开始于234xxxxxx和2345xxxxx ...怎么样用sql查询语句做吗?


喜欢这个,

展开 | 选择 | Wrap | 行号

解决方案


i有一个列有一些列,其中一列是电话号码。


所以,如果我想计算电话号码以234xxxxxx开头, 2345xxxxx ...用sql查询语句怎么做?


喜欢这个,


从table1中选择count(*),其中phonenumber = 234xxxx和2345xxxxx


它的关键字是什么?


我被困了。

请帮助

来自

Nick



查看以下查询:

展开 | 选择 | 换行 | 行号


< blockquote>


查看以下查询:


SELECT COUNT(*)FROM table1 WHERE phonenumber LIKE''234%''或phonenumber LIKE' '2345%''


(或)


SELECT COUNT(*)FROM表WHERE SUBSTR(phonenumber,1,3)='''234''或SUBSTR (phonenumber,1,4)='''2345''



我可以使用AND而不是OR吗?




我可以使用

展开 | 选择 | Wrap | 行号



我可以使用AND代替OR吗?




我可以使用



选择count(*)表table1,其中name =''nick''和year =''200 7''和substr(phonenumber,1,3)='''234''和substr(phonenumber,1,4)='''2345'';



在发布我们的代码时,所有人都记得使用[code = mysql]标签。

@OP为什么不要''你试试看看会发生什么?你会用那种方式学得更好。阅读教程也不错。


i have a table with some column, one of the column is phone number.

so if i want to count the phone number start with 234xxxxxx and 2345xxxxx ...how to do it with sql query statement?

like this,

Expand|Select|Wrap|Line Numbers

解决方案

i have a table with some column, one of the column is phone number.

so if i want to count the phone number start with 234xxxxxx and 2345xxxxx ...how to do it with sql query statement?

like this,

select count(*) from table1 where phonenumber = 234xxxx and 2345xxxxx

what is the keyword for it ?

i''m stuck.
pls help
from
Nick

Check below Queries:

Expand|Select|Wrap|Line Numbers


Check below Queries:

SELECT COUNT(*) FROM table1 WHERE phonenumber LIKE ''234%'' OR phonenumber LIKE ''2345%''

(or)

SELECT COUNT(*) FROM table WHERE SUBSTR(phonenumber,1,3) = ''234'' OR SUBSTR(phonenumber,1,4) = ''2345''

can i use AND instead of OR ?

or

can i use

Expand|Select|Wrap|Line Numbers


can i use AND instead of OR ?

or

can i use

Select count(*) form table1 where name = ''nick'' and year = ''2007'' and substr(phonenumber,1,3) = ''234'' and substr(phonenumber,1,4) = ''2345'';

Guys let''s all remember to use [code=mysql] tags when posting our code.
@OP Why don''t you try them and see what happens? You''ll learn better that way. Reading a tutorial is also not a bad idea.


这篇关于在表格中搜索关键字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆