[英]extracting specific position of character details from sql
I have database like the image and i want show to t1 details whose name is an 'e' in second position and 'x' in the last position , can any one provide me help how to to achieve this我有像图像这样的数据库,我想向 t1 显示其名称在第二个位置为“e”而在最后一个位置为“x”的详细信息,任何人都可以向我提供如何实现这一目标的帮助
The table looks like this桌子看起来像这样
T1 T2 T3
vexes 1 2
becw 12 21
extrst 10 10
vin 15 10
new 35 14
det 10 12
het 15 10
cat 53 52
fexx 10 15
fat 12 15
fatsrot 10 15
You can write your query like following.您可以像下面这样编写查询。
select * from yourtable
where t1 like '_e%x'
Note :注意:
_ Represents a single character _代表单个字符
% Represents zero or more characters %代表零个或多个字符
You could achieve it by using SUBSTRING
and RIGHT
in following:您可以通过在以下使用
SUBSTRING
和RIGHT
来实现它:
SELECT *
FROM tbl
WHERE SUBSTRING(t1, 2, 1) = 'e' --2nd character
AND RIGHT(t1, 1) = 'x' --last character
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.