SQL--一条语句,各种嵌套,能看懂的都是大神!

一条语句,各种嵌套,你能看懂吗?

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";
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 11
    评论
评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值