Reputation: 1044
Order by date wise report problem
select
liftingbirds, totalweight, avgweight, dcno,
convert(varchar,liftingdate,103) as liftingdate
from
k_LiftingEntryRecords
where
dcno = @dcno
order by
liftingdate desc
Here I am not getting order wise date report ...when I remove where condition
dcno = @dcno
, then it comes order wise date report...
select
liftingbirds, totalweight, avgweight, dcno,
convert(varchar,liftingdate,103) as liftingdate
from
k_LiftingEntryRecords
order by
liftingdate desc
other wise it's not come.. like
Upvotes: 0
Views: 210
Reputation: 14820
varchar
is a string not a date. String comparison in sql server is done alphabetically which is very different to ordering by a date data type. Let me know If you understand the difference otherwise I'll expand my answer
Upvotes: 1