select distinct convert( varchar, purchasingMonth, 101 ) purchasingMonth, purchasingMonth purchasingMonthRaw
from tbl_DW_OperatorAnalyzer_#client.ownertype##client.ownerid# with (nolock)
where ownerId =
and ownerType =
and purchasingMonth <= getDate()
order by purchasingMonthRaw desc
select *
from qmd_data
order by purchasingMonthRaw desc