dear all I tried to add query into crystal report command the query is
Declare @FromDate Datetime
Declare @ToDate Datetime
Declare @Whse nvarchar(10)
select @FromDate = min(S0.Docdate) from dbo.OINM S0 where S0.Docdate >={?@FromDate}
select @ToDate = max(S1.Docdate) from dbo.OINM s1 where S1.Docdate <={?@ToDate}
select @Whse = Max(s2.Warehouse) from dbo.OINM S2 Where S2.Warehouse ='[%2]'
Select @Whse as 'Warehouse', a.Itemcode, max(a.Dscription) as ItemName,
sum(a.OpeningBalance) as OpeningBalance, sum(a.INq) as 'IN', sum(a.OUT) as OUT,
...
the original query is
...select @FromDate = min(S0.Docdate) from dbo.OINM S0 where S0.Docdate >='[%0]'
select @ToDate = max(S1.Docdate) from dbo.OINM s1 where S1.Docdate <='[%1]'
select @Whse = Max(s2.Warehouse) from dbo.OINM S2 Where S2.Warehouse ='[%2]'
I changed '[%0]
to be >={?@FromDate}
(parameter) and it is work fine the same for '[%1]'
now I can't change '[%2]'
the only thing work with me is to change it into {?@Whse}
but this give me wrong data in the report
regards
change it to
select @Whse = Max(s2.Warehouse) from dbo.OINM S2 Where S2.Warehouse ={?@select*from OWHS}
its work fine but for if you select more than one warehouse you will have error