按日期排序报告问题
select
liftingbirds, totalweight, avgweight, dcno,
convert(varchar,liftingdate,103) as liftingdate
from
k_LiftingEntryRecords
where
dcno = @dcno
order by
liftingdate desc
这里我没有获得订单明智的日期报告......当我删除条件时
dcno = @dcno
,那就是订单明智的日期报告...
select
liftingbirds, totalweight, avgweight, dcno,
convert(varchar,liftingdate,103) as liftingdate
from
k_LiftingEntryRecords
order by
liftingdate desc
另外,它不会来......就像
答案 0 :(得分:1)
varchar
是一个字符串而不是日期。 sql server中的字符串比较按字母顺序完成,这与按日期数据类型排序非常不同。让我知道如果您了解其中的差异,否则我会扩大我的答案