如何根据技能收集获取记录 [英] how to get the records based on skill collection
本文介绍了如何根据技能收集获取记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Sql Server中有要求
我的第一张表格中包含SkillSet,如.net,mvc,jquery,其中一张唱片
和我的个人资料表我有候选技能组,如mvc / mvc,jquery
基于上述值.net,mvc,jquery我们必须得到个人资料表的记录。 。
如何解决这个问题
请帮助我
问候,
Syed Khaleel
I have requirement in Sql Server
My First Table having SkillSet Like .net,mvc,jquery in one of records
and in My Profile Table iam having candidate skillset like mvc/mvc,jquery
based on above value .net,mvc,jquery we have to get the records of profile table..
how can i solve this problem
Pleas help me
Regards,
Syed Khaleel
推荐答案
Hi Syed,
您可能更喜欢UNION运营商
[ ^ ]这样做。
赞
Hi Syed,
You could preferUNION operator
[^] to do this.
Like
SELECT * FROM MyProfileTable WHERE candidateSkillset IN
( SELECT candidateSkillset FROM MyProfileTable
UNION
SELECT SkillSet FROM SkillSetTable )
希望这对你有所帮助。
问候,
RK
Hope this helps you a bit.
Regards,
RK
联合查询是愚蠢的。所以使用子查询。如果技能是单个字符串,就像在一个单元格中是.net,MVC,jquery,那么你的数据库设计就是垃圾,需要修复。你需要一张这样的桌子:
MyProfileTable
(
ProfileId int,
......别的什么
)
这样的一个:
candidateSkillset
(
skillsetId int
)
和一个像这样:
创建表技能
(
skillId int identity,
技能varchar(50)
)
然后一个像这样:
CandidateSkills
(
skillId int,
candidateId int
)
和这样一个:
SkillsetSkill
(
skillsetId int,
SkillId int
)
然后你会在skillsetskill.skillid = candidateskills.skillid进行加入。
如果您需要更多信息,请先发布表格的模式和一些示例da TA。如果你的数据库像我怀疑的那样破碎而且你无法改变它,它仍然可以完成,但它总是很糟糕。
The union query is stupid. So is using a subquery. If the skills are in a single string, as in one cell is .net, MVC, jquery, then your database design is crap and needs fixing. You need a table like this:
MyProfileTable
(
ProfileId int,
... whatever else
)
And one like this :
candidateSkillset
(
skillsetId int
)
and one like this:
create table skill
(
skillId int identity,
skill varchar(50)
)
Then one like this:
CandidateSkills
(
skillId int,
candidateId int
)
and one like this:
SkillsetSkill
(
skillsetId int,
SkillId int
)
Then you would do a join where skillsetskill.skillid = candidateskills.skillid.
If you need more info, start by posting the schema of your tables and some sample data. If your database is as broken as I suspect and you can't change it, it can still be done, but it will always be bad.
这篇关于如何根据技能收集获取记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文