TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ahmed elbarbary
NA
1.6k
277.9k
How to get parts that not have same features count on table settings b
Dec 24 2020 6:56 AM
How to get parts that not have same features count on table settings by code typeid and pl ?
I work on sql server 2012 . if face issue I can't get parts that not have all features on table settings
so I will count distinct features from table settings and compare it with count features per part
if count features per part on table part feature <>count distinct features on table settings by PLID and code type
then display it .
as example part 9010 have only one feature 15000160 from table settings and not have feature 15000171
then display it .
as example part 9041 have only one feature 15000171 from table settings and not have feature 15000160
then display it .
part id 7731 have two features 15000171,15000160 as part settings have two features then no need
to display it because it have full features
so How to write query do that
create
table
#settings
(
SettingId
int
,
PLID
INT
,
CodeType
int
,
Code nvarchar(50),
featureKey
int
)
insert
into
#settings
values
(1,2890,798541,
'Ear99'
,
NULL
),
(1,2890,798541,
'Ear70'
,15000160),
(1,2890,798541,
'Ear99'
,15000171),
(1,2890,798541,
'e900841'
,15000160)
create
table
#partFeature
(
PartId
int
,
FeatureKey
int
)
insert
into
#partFeature
values
(9010,15000160),
(7070,15000171) ,
(9041,15000171) ,
(2030,15000160) ,
(5871,15000160) ,
(5871,15000171) ,
(7731,15000160) ,
(7731,15000171)
result I need
PartId FeatureKey
9010 15000160
7070 15000171
9041 15000171
2030 15000160
Reply
Answers (
0
)
How to use Cursor to Execute stored procedure where featurevalue is b?
I am getting duplicate rows how to remove in sql server