Click here to Skip to main content
15,894,124 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
This is my query

C#
string cmd = "select Itemname,item_variant,size,quantity from tbl_precount";


output :

HTML
Itemname           item_variant              size           quantity
Manhattan              black                  XS                60
                       black                  XS                70
                       black                  XS                90


HTML
ROPONGGIA              black                  XS                60
                       black                  XS                11
                       black                  XS                100


Problem:
I just want to show the latest record in each group.
Im using crytal report.


Thanks!
Posted
Updated 3-Jun-14 22:19pm
v3

1 solution

try this

SQL
select top 1 itemname,item_variant,size,quantity from tbl_precount 
order by itemname, per size, and per item_variant desc


i havn't tried this
try it and say the result..:)
 
Share this answer
 
v2
Comments
Zj Pineda 4-Jun-14 3:13am    
select top 1 Itemname,item_variant,size,quantity from tbl_precount order by Itemname,size,item_variant desc
result 1 record returned.

i need to get the latest record group by Itemname,size

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900