---Union all usage instance SQL
SELECT TOP (PERCENT) ID, bid_user_id, UserName, amount, Createtime, Borrowtype
from (SE Lect bid.id, bid.bid_user_id, Reg. UserName, Bid.amount, bid.createtime, ' common standard ' as Borrowtype
from dbo. Yyd_borrow_bidrecord as bid
INNER JOIN dbo. Yyd_users_reginfo as Reg on reg.id = bid.bid_user_id
WHERE (bid.id not in (SELECT bid
from dbo. Hur_newplanloan_itemloan) and (Bid.id not in
(SELECT bidid from dbo. hur_product_matching))
UNION all
SELECT bid.id, Bid.userid, Reg. UserName, Bid.amount, Bid.createtime, ' plan ' as Borrowtype
from dbo. Hur_newplanloan_bidrecord as bid
INNER JOIN dbo. Yyd_users_reginfo as Reg on reg.id = Bid.userid
UNION all
SELECT Buy.buyid, Buy.userid, Reg. UserName, Buy.amount, buy.createdate, ' buy ' as Borrowtype
from dbo. Hur_product_buy as Buy
INNER JOIN dbo. Yyd_users_reginfo as Reg on reg.id = Buy.userid) as Data
ORDER by bid_user_id, Createtime DESC
Use instance SQL for Union all