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
278.1k
How to write update statement to table statusvalues where chemical id
Sep 2 2020 7:58 PM
How to write update statement to table statusvalues where chemical id have more than one chemical status ?
I work on SQL server 2012 I face issue ; I can't update status on table statusvalues where chemical id have more than one status
as example
1241 must update status "chemical id have multiple status" because chemicalid have 2 status Rohs and china
1600 not update status because it have only one status as LifeCycle .
create
table
#chemical
(
chemicalId
int
,
PartId
int
,
chemicalStatus nvarchar(50)
)
insert
into
#chemical(chemicalId,PartId,chemicalStatus)
values
(1241, 2250,
'Rohs'
),
(1241, 2700,
'Rohs'
),
(1241, 2900,
'China'
),
(1600, 2950,
'Lifecycle'
),
(1600, 3000,
'Lifecycle'
)
create
table
#statusvalues
(
chemicalid
int
,
status nvarchar(50)
)
insert
into
#statusvalues(chemicalid)
values
(1241),
(1600)
Expected result :
chemicalid status
1241 chemical id have multiple status
1600
NULL
Reply
Answers (
1
)
Can i execute my code without error.
What should be considered before creating indexes?.