问题描述
如何实现这个结果,任何人都可以帮我在Sqlserver女士查询
1st Table Emp
-----------------------
EId姓名年龄
1 A 15
2 B 25
3 C 45
第二桌 AgeDetails
------------------------
Aid AgeGroup MinAge MaxAge
1年轻1 17
2成人18 40
3年龄较大41 60
结果
-----------------
EId Name AgeGroup
1 A Young
2 B成人
3 C岁
谢谢...
Hi,
How to Achieve this Result,Can Anyone help me for query in Ms Sqlserver
1st Table Emp
-----------------------
EId Name Age
1 A 15
2 B 25
3 C 45
2nd Table AgeDetails
------------------------
Aid AgeGroup MinAge MaxAge
1 young 1 17
2 Adult 18 40
3 Older 41 60
Result
-----------------
EId Name AgeGroup
1 A Young
2 B Adult
3 C older
Thanks...
推荐答案
Name,AgeGroup
From Emp Inner Join AgeDetails
On Emp.Age Between MinAge And MaxAge
SELECT e.eid,e.Name,ag.AgeGroup
FROM emp e, AgeDetails ag
WHERE e.age between ag.min and ag.max
享受..
Enjoy..
这篇关于如何在sqlserver中选择具有年龄组的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!