Fetch data from single table using different condition using single query

Hi,
Trying to fetch information from below table using two queries. Is it possible to retrieve the results of these two queries using a single query?

Declare @testspecName table (specId int,SpecName varchar(50),type char(10))

Insert Into @testspecName 
 Values (101, 'tyre','parts')
      , (102, 'wheel','parts')
	  , (103, 'steering','parts')
	  , (104, 'car','vehicle')
      , (105, 'bike','vehicle')

select * from @testspecName where type like 'parts'
select * from @testspecName where type NOT like 'parts'

select * from @testspecName

1 Like

Technically:

select * from @testspecName where type is not null

1 Like

hi razeena

what did you have in mind !!
when you asked

select * from @testspecName where type like 'parts'
select * from @testspecName where type NOT like 'parts'

i mean its obvious both will give the whole table results!!

but did you have something else in mind !!
:slight_smile:

It won't necessarily give you the whole table. If type is NULL, it will not appear in either query.

thanks Scott .. !!!