我有两张表,分别是装运和付款表,其中包含以下列
运输
1.Executivename
2.shipername
3.shiperaddress
4.acountno
5.invoiceno
6.shipdate
etc.
支付
1.InvoiceNo
2.accountno
3.Date
4.Discount
5.ReceivedAmount 6.MoneyReceiptNo
现在我想用“付款”表的字段按执行名称生成报告。我尝试通过以下存储过程来做到这一点-
CREATE PROCEDURE [dbo].[rptexecutivepayment] @executivename varchar(20) AS
BEGIN
select Executivename,[shipment].accountno,[date],discount,receivedamount,moneyreceiptno
from shipment
full join payment on shipment.accountno=payment.accountno and shipment.invoiceno=payment.invoiceno
where Executivename=@executivename order by Executivename
END
GO
但是,报告 r 生成数据重复。我现在能做什么?请有人帮助我。