CurtisB
CurtisB

Reputation: 1

Joining two datasets into one query

I am wanting to join two Datasets into one table.

We have branch codes which depict what data to produce. Is there a way I can join two branch data into one table?

select PartRefCategory
      , Company
      , BranchCode
      , convert(Date, DateOnly,3) As DatedOnly
      , (Quantity*UnitFinalPriceExcTax) As Sales 
from [dbo].[RPTSalesByTime] 
where 
     PartRefCategory NOT IN ('GIFT', 'POS', '') 
     AND BranchCode='BM8' 
     AND DateOnly>=DateAdd(DD, -6, @ByDate) 
     AND DateOnly<=@ByDate  
     AND NOT (quantity >'1000' or quantity <'-1000')
order by PartRefCategory, BranchCode

Upvotes: 0

Views: 62

Answers (1)

Nick
Nick

Reputation: 147206

You can use an IN expression to select from multiple BranchCode values. Change

BranchCode='BM8'

to (e.g.)

BranchCode IN ('BM8', 'ABC')

Upvotes: 2

Related Questions