karthikha0706
New Member
- Joined
- Oct 30, 2013
- Messages
- 45
From the below query i able to retrieve the data where type is "X". However, i would like to retrieve the data where type is "Y" and "Z" along with "X".
Qry = "with cte as (select *, row_number() over (partition by vechile order by [Date1] DESC) as Rn, max(convert(int,turnover))over (partition by vechile)as MaxQty from Dailyanalysis where [Date1] between (' " & dfrom & " ')And (' " & dto & " ' ))select vechile,type,date1,convert(int,turnover)as turnover, from cte where Rn = 1 And convert(int,turnover )= MaxQty AND type=('X') AND DATE1=(' " & dto & " ' );"
Please assist me with the code.
Qry = "with cte as (select *, row_number() over (partition by vechile order by [Date1] DESC) as Rn, max(convert(int,turnover))over (partition by vechile)as MaxQty from Dailyanalysis where [Date1] between (' " & dfrom & " ')And (' " & dto & " ' ))select vechile,type,date1,convert(int,turnover)as turnover, from cte where Rn = 1 And convert(int,turnover )= MaxQty AND type=('X') AND DATE1=(' " & dto & " ' );"
Please assist me with the code.