如何在sqlserver中获取最新记录。按项目名称和项目颜色分组 [英] How to get the latest record in sqlserver . Group by item name and by item colors
本文介绍了如何在sqlserver中获取最新记录。按项目名称和项目颜色分组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的查询
This is my query
string cmd = "select Itemname,item_variant,size,quantity from tbl_precount";
输出:
output :
Itemname item_variant size quantity
Manhattan black XS 60
black XS 70
black XS 90
ROPONGGIA black XS 60
black XS 11
black XS 100
问题:
我只想展示每组中的最新记录。
我使用crytal repor t。
谢谢!
Problem:
I just want to show the latest record in each group.
Im using crytal report.
Thanks!
推荐答案
试试这个
try this
select top 1 itemname,item_variant,size,quantity from tbl_precount
order by itemname, per size, and per item_variant desc
i没有尝试过这个
尝试并说结果.. :))
i havn't tried this
try it and say the result..:)
这篇关于如何在sqlserver中获取最新记录。按项目名称和项目颜色分组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文