如何只选择一个具有相同Id(票号)的记录? [英] How to Select only one record with the same Id (Bill Number)?
问题描述
这里我有代码。
显示整个记录我需要只显示一个带有账单号的记录。
在我的情况下,账号13显示3结果我只需要带有此ID的最后一条记录。
Here I am having the code.
It showing the entire record i need to show only one record with bill number.
In my case bill number 13 showing 3 results i need only last record with this id.
create procedure [dbo].[bindgv]
as
select [Bill Number],Date,Name,Particulars,Amount from Sontra_task
order by Date desc
Bill.No |日期|名称|部分。 |金额
17 | 2013年12月25日|阿玛| FFR2 | 5788
12 |二零一三年十二月十二日|阿什拉夫| FFR2 | 566
2 |二〇一三年十二月十日|甘露| FF $ | 5454654654
13 | 2013年12月28日|达乌德| b | 2000
13 | 2013年12月28日|达乌德| c | 3000
13 | 2013年12月28日|达乌德| a | 1000
6 | 2013年12月14日| Komal FFR1 | 1500
i希望显示如下结果...
17 2013-12-25 Amar FFR2 5788
12 2013-12-12 ashraf FFR2 566
2 2013-12-10 Amrita FF $ 5454654654
13 12/28 / 2013 Dawood b 2000
6 12/14/2013 Komal FFR1 1500
有人建议我提出完美的查询。
谢谢
Bill.No | Date | Name | Part. | Amount
17 | 2013-12-25 | Amar | FFR2 | 5788
12 | 2013-12-12 | ashraf | FFR2 | 566
2 | 2013-12-10 | Amrita | FF$ | 5454654654
13 | 12/28/2013 | Dawood | b | 2000
13 | 12/28/2013 | Dawood | c | 3000
13 | 12/28/2013 | Dawood | a | 1000
6 | 12/14/2013 | Komal FFR1 | 1500
i want to show the result like the following ...
17 2013-12-25 Amar FFR2 5788
12 2013-12-12 ashraf FFR2 566
2 2013-12-10 Amrita FF$ 5454654654
13 12/28/2013 Dawood b 2000
6 12/14/2013 Komal FFR1 1500
Could anybody suggest me for a perfect query.
Thank you
推荐答案
| 5454654654
13 | 2013年12月28日|达乌德| b | 2000
13 | 2013年12月28日|达乌德| c | 3000
13 | 2013年12月28日|达乌德| a | 1000
6 | 2013年12月14日| Komal FFR1 | 1500
i希望显示如下结果...
17 2013-12-25 Amar FFR2 5788
12 2013-12-12 ashraf FFR2 566
2 2013-12-10 Amrita FF
| 5454654654
13 | 12/28/2013 | Dawood | b | 2000
13 | 12/28/2013 | Dawood | c | 3000
13 | 12/28/2013 | Dawood | a | 1000
6 | 12/14/2013 | Komal FFR1 | 1500
i want to show the result like the following ...
17 2013-12-25 Amar FFR2 5788
12 2013-12-12 ashraf FFR2 566
2 2013-12-10 Amrita FF
5454654654
13 12/28/2013 Dawood b 2000
6 12/14/2013 Komal FFR1 1500
任何人都可以建议我一个完美的查询。
谢谢
5454654654
13 12/28/2013 Dawood b 2000
6 12/14/2013 Komal FFR1 1500
Could anybody suggest me for a perfect query.
Thank you
请检查以下链接
[ ^ ]
plz check the following link
[^]
这篇关于如何只选择一个具有相同Id(票号)的记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!