SQLTeam.com | Weblogs | Forums

Query


#1

Hi

Inputs will be Date From & Date To . Party Name
I have 3 tables Sales Order ,Sales Lines & Item . I want to create a query to display party wise sale . Fields will be Sale Order No , date , party , item , qty , amount .

Thanks


#2
SELECT [Sale Order No] , [date] , [party] , [item] , [qty] , [amount]
FROM   [your table name]
WHERE [date] >= @DateFrom
AND   [date] <= @DateTo 
AND   [Party Name] = @PartyName

#3

@jsshivalik Beware if your [date] column is actually Date Time, if so you need to do the equivalent of:

WHERE [date] >= @DateFrom
AND   [date] <  @DateTo_PlusOneDay

#4

Dear All

There are 3 tables , not 1 table

Thanks


#5

then just JOIN them to get the required result