I work on sql server 2017 i face issue i can't get partnumber
that have at least source type website and at least have stockid equal 1 per partnumber
so with another meaning i need to get part numers that have stockid 1 and source type website
so i need to make select query get part numbers that must have source type website and stock =1 Based on Part number
sample data
create table #stockyes
(
PartNumber varchar(100),
sourcetype varchar(100),
stockid tinyint
)
insert into #stockyes(PartNumber,sourcetype,stockid)
values
(1233,'Website',1),
(1233,'Website',0),
(1233,'Datasheet',1),
(8901,'Website',1),
(8901,'Website',0),
(9015,'Website',1),
(7801,'Website',1),
(7801,'Website',1),
(9401,'Datasheet',0),
(5688,'Datasheet',0),
(5688,'Datasheet',0),
(5688,'Lifecycle',2),
(5688,'Lifecycle',2),
(8409,'Lifecycle',1),
(6703,'Website',0),
(6703,'Website',0),
(6703,'Website',0),
(3099,'Website',0),
(3099,'Website',0),
(8541,'Website',0)
expected result
Select partnumber from #stockyes where sourcetype = ‘website’ and stockid = 1
or am I missing something your not detailing in the question?
February 28, 2022 at 8:42 am
thank you for support
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply