一条语句,各种嵌套,你能看懂吗?
sql = "select * from(select * from ( SELECT T_BorrowLog.itemNo,T_Item.itemName,T_Category.categoryName,T_BorrowLog.number,T_BorrowLog.purpose,T_Storage.storageName,T_BorrowLog.positionID,v_user.user_name as userName,v_user.email as mail,T_BorrowLog.lendingDate,T_BorrowLog.returnDate,T_BorrowLog.status,T_BorrowLog.remark,T_BorrowLog.applicant,T_BorrowLog.storageID,T_BorrowLog.op,T_BorrowLog.lendingTime,T_Item.isConsumables,T_BorrowLog.isDel
FROM T_BorrowLog
INNER JOIN T_Item ON T_BorrowLog.itemNo = T_Item.itemNo
INNER JOIN T_Category ON T_Item.categoryID = T_Category.categoryID
LEFT JOIN v_user ON T_BorrowLog.op = v_user.user_code
INNER JOIN T_Storage ON T_BorrowLog.storageID = T_Storage.storageID) as V_MyAppliCation
where status=@GoodsInfo and applicant= @applicant and isDel = 0
ORDER BY isConsumables)as aa
ORDER BY case when isConsumables='非消耗品' then 0 else 1 end limit @begin,@pageSize";