sql新手。我试图把所有的记录,其中“客户号码”是一个12位数字。在“客户编号”列中,只有9位或12位数字。我只需要客户谁的“客户号码”是12位数字。似乎很直截了当,但没能弄明白。谢谢
doinxwow1#
你可以用 len() / length() (取决于您的数据库):
len()
length()
select t.* from t where len(customer_number) = 12
你也可以使用 like :
like
where customer_number like '____________' -- exactly 12 underscores
wbrvyc0a2#
select customer_num from xx_customers where length(customer_num)=12; ``` `Length` 函数可用于where条件
2条答案
按热度按时间doinxwow1#
你可以用
len()
/length()
(取决于您的数据库):你也可以使用
like
:wbrvyc0a2#