有两张表,一张存放的是明细(分店编码,交易编码,金额,日期),另一张存放的是付款明细(分店编码,交易编码,付款方式,付款金额,日期)
这里需要说明的一点是,一条交易单可以有多中支付方式,付款明细表里存放的数据就是该单据用1支付方式支付了多少钱,2支付方式支付了多少钱,
我现在需要找出所有使用2或者1+2支付方式的明细,然后算折扣金额。
请问这个找的SQL该如何写?
select * from temp right join temp2 on temp.storeno=temp2.storeno and temp.workdate=temp2.workdate and temp.selseq=temp2.selseq
取出来的有重复。
谢谢