This is the query for sorting date.It works fine but when i adding where condition it throws error..
select date1 from (select distinct convert(varchar,convert(datetime,Date,105),103) as date1,convert(datetime,Date,103)as date2 from Tyre_StockEntry) g order by convert(datetime,convert(varchar,date1,2),103) desc Where Brand='Apollo' and Pattern='Sedan'
Error:
Incorrect syntax near the keyword 'Where'.
Can any one help me out..