如何检索名字以字母R开头的所有员工? [英] How to retrieve all the employees whose firstname starts with letter R?

查看:169
本文介绍了如何检索名字以字母R开头的所有员工?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为tbl_emp的表,其中包含(名字,姓氏,生日,文明,宗教)。如何在不使用LIKE'R%'和子字符串的情况下获得名字以字母R开头的所有员工。还有另一种方式吗?



我尝试过:



SELECT firstname

FROM tbl_emp

WHERE firstname LIKE'5%'



,另一个使用子串。

Ihave a table named tbl_emp which contains (firstname,lastname,birthdate,civilstatus,religion). How can I get all the employees whose first name starts with letter R without using LIKE 'R%' and substring. Is there another way?

What I have tried:

SELECT firstname
FROM tbl_emp
WHERE firstname LIKE '5%'

and the other one uses substring.

推荐答案

这与SUBSTRING的解决方案完全相同,但您可以使用 LEFT(Transact-SQL)| Microsoft Docs [ ^ ]

你的LIKE错了: LIKE'R%'不是 LIKE'5 %'(但你错误输入,我怀疑)。
It's really the same solution as the SUBSTRING, but you could use LEFT (Transact-SQL) | Microsoft Docs[^]
And your LIKE is wrong: LIKE 'R%' not LIKE '5%' (but you just mistyped, I suspect).


这篇关于如何检索名字以字母R开头的所有员工?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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