按日期排序报告问题
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
其他明智的它不会来..
varchar
是一个字符串而不是日期。sql Server 中的字符串比较是按字母顺序完成的,这与按日期数据类型排序有很大不同。让我知道如果你了解其中的区别,否则我会扩展我的答案