select kindtypeid,one,two,three,four,price from
(select (tb_receive_detail.kindtypeid) as kindtypeid,(tb_receive.date_re) as one,(tb_vendor.VendorName) as two,(tb_receive.invoice_id) as three,(tb_receive_detail.quantity) as four,(tb_receive_detail.price) as price from tb_receive
inner join tb_receive_detail on tb_receive.re_id = tb_receive_detail.re_id
inner join tb_vendor on tb_receive.VendorCode = tb_vendor.VendorCode
union
select (tb_pay_detail.kindtypeid) as kindtypeid,(tb_pay.pay_date) as one,(tb_department.dep_name) as two,(tb_pay.book_id) as three,(tb_pay_detail.pay_amount) as four,(tb_pay_detail.pay_price/tb_pay_detail.pay_amount) as price from tb_pay
inner join tb_pay_detail on tb_pay.pay_id=tb_pay_detail.pay_id
inner join tb_department on tb_pay.dep_id = tb_department.dep_id) as a where kindtypeid = 6 order by one desc
select kindtypeid,one,two,three,four,price from
(select (tb_receive_detail.kindtypeid) as kindtypeid,(tb_receive.date_re) as one,(tb_vendor.VendorName) as two,(tb_receive.invoice_id) as three,(tb_receive_detail.quantity) as four,null as five,(tb_receive_detail.price) as price from tb_receive
inner join tb_receive_detail on tb_receive.re_id = tb_receive_detail.re_id
inner join tb_vendor on tb_receive.VendorCode = tb_vendor.VendorCode
union
select (tb_pay_detail.kindtypeid) as kindtypeid,(tb_pay.pay_date) as one,(tb_department.dep_name) as two,(tb_pay.book_id) as three,null as four,(tb_pay_detail.pay_amount) as five,(tb_pay_detail.pay_price/tb_pay_detail.pay_amount) as price from tb_pay
inner join tb_pay_detail on tb_pay.pay_id=tb_pay_detail.pay_id
inner join tb_department on tb_pay.dep_id = tb_department.dep_id) as a where kindtypeid = 6 order by one desc