hanshuangyaya 2015-09-16 06:24 采纳率: 0%
浏览 4181

SQL 语句求解答WITH(NOLOCK) INNER JOIN

DECLARE @indexTabel TABLE(Nid int IDENTITY(1,1) PRIMARY KEY,Id nvarchar(50))
INSERT INTO @indexTabel
SELECT ho.SerialId FROM [TCHotelOrder].dbo.HotelOrder ho
WITH(NOLOCK) INNER JOIN [TCHotelOrder].dbo.HotelOrderNewExtend hone
WITH(NOLOCK) ON hone.SerialId = ho.SerialId AND hone.CurrentTrackID > 0

LEFT JOIN [TCHotelOrder].dbo.HotelOrderExtendCtrip hoec
WITH(NOLOCK) ON hone.SerialId = hoec.OrderSerialId

LEFT JOIN [TCHotelOrder].dbo.HotelOrderExtendTripHotel hoectrip
WITH(NOLOCK) ON hone.SerialId = hoectrip.OrderSerialId WHERE 1=1 AND ho.CreateDate>='2015-09-15' AND hoectrip.Id > 0

GROUP BY ho.SerialId,ho.CreateDate

ORDER BY ho.CreateDate
DESC DECLARE @RowCountVar INT;
SET @RowCountVar=@@ROWCOUNT;
SELECT @RowCountVar;
SET @RowCountVar = (case when (@RowCountVar SELECT ho.SerialId,hi.Name,ho.MComeMobile,ho.MComeName,ho.MMobile,ho.Flag,ho.ConfirmType,ho.BookType,ho.IsHotelConfirm,ho.HotelType ,ho.Rooms,ho.Amount,ho.ComeDate,ho.LeaveDate,ho.CreateDate,hot.CurrentOperatorName,hot.CurrentAnchor,hot.TrackId,hoec.CtripOrderId ,hone.HONEIsTimelyConfirmed,hone.IsEndOrder,isnull(hone.HONEIsCCTOrder,0) as iscct ,hone.HONEIsPromo ,hone.HONECurrency Currency ,hi.HICtripHotelMonthTrial CtripHotelMonthTrial ,hone.IsHandselTickets
FROM @indexTabel it inner join [TCHotelOrder].dbo.HotelOrder ho
with(nolock) on it.Id=ho.SerialId left join [TCHotelResource].dbo.HotelInfo hi
with(nolock) on ho.HotelId=hi.Id left join [TCHotelOrder].dbo.HotelOrderNewExtend hone
with(nolock) on ho.SerialId=hone.SerialId left join [TCHotelOrder].dbo.HotelOrderTrack hot
with(nolock) on (hone.CurrentTrackID=hot.TrackId and hone.CurrentTrackID0) LEFT JOIN [TCHotelOrder].dbo.HotelOrderExtendCtrip hoec
WITH(NOLOCK) ON hone.SerialId = hoec.OrderSerialId
/*Flat:TC_HotelOrderAdmin/Author:酒店客服系统/For:订单查询/File:///TC_HotelOrderAdmin.DataAccess.HotelDBConfig.cs/Fun:GetSqlComments/InquiryMan:System*/
WHERE it.Nid> (@RowCountVar-1)*10 AND it.Nid< (@RowCountVar*10+1) order by it.Nid

请问以上语句是什么意思啊?求每个语句的详细解释

  • 写回答

2条回答 默认 最新

  • LongRui888 2015-09-16 06:45
    关注

    WITH(NOLOCK) 这个是sql server里的查询提示,nolock表示 在select读取数据时,不对要读取的数据加锁,所以这种操作也不会被锁定,因为可能你要读的数据,别人正在update,就会被锁住。

    INNER JOIN :就是内连接,比如 a inner join b,就是a和b都有的才会出来。

    评论

报告相同问题?

悬赏问题

  • ¥15 在虚拟机中安装flash code
  • ¥15 单片机stm32f10x编写光敏电阻调节3.3伏大功率灯亮度(光强越大灯越暗,白天正常光强灯不亮,使用ADC,PWM等模块)望各位找一下错误或者提供一个可实现功能的代码
  • ¥20 verilog状态机方法流水灯
  • ¥15 pandas代码实现不了意图
  • ¥15 GD32H7 从存储器到外设SPI传输数据无法重复启用DMA
  • ¥25 LT码在高斯信道下的误码率仿真
  • ¥45 渲染完成之后将物体的材质贴图改变,自动化进行这个操作
  • ¥15 yolov5目标检测并显示目标出现的时间或视频帧
  • ¥15 电视版的优酷可以设置电影连续播放吗?
  • ¥50 复现论文;matlab代码编写