Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有以下查询:
Select * from Students
它检索:Id、Name、Class和School.
Id
Name
Class
School
我希望,无论 Class 的值是什么,只要返回 Class = 10。有没有办法在 sql 查询中做到这一点?
10如果您想要每行 10 个,只需替换
10
Select Id, Name, 10 as class, School from Students
如果你的意思是有条件的
Select * from Students WHERE Class = 10
你可以做
select id, name, '10' as class, School from students
无论实际存储的类值是什么,都可以在类列中取回 10。