0

如果有人可以帮助我进行此查询。我正在使用以下查询,但它不起作用

WITH cte AS 
(select   sb.ImageId, sb.LicenceType, sb.ImgCollection, sb.nbofviews, sb.orientation, sb.shootdate, sd.ImgName, sd.Caption, sd.ImgPath, sd.ImageType, sd.ImgHoverPath,  sc.image_color from searchinitial si INNER JOIN SearchBrain sb ON si.ImageId = sb.ImageId INNER JOIN searchcolors sc ON si.ImageId = sc.ImageId INNER JOIN searchdetails sd ON si.ImageId = sd.ImageId where  si.Primarykeyword in (Select Primary_kwd from p2_kwdmgmt where all_kwd in ('man','jumping', 'beach'))group by si.ImageIDhaving count(distinct si.Primarykeyword) = 3 order by si.imageid desc)
SELECT * FROM cte WHERE ROW BETWEEN 0 AND 31
4

1 回答 1

1

而不是使用 CTE 和/或row_number,为什么不直接使用SELECT TOP n

  select top 30
  ....
  order by si.imageid desc
于 2013-08-05T10:25:12.090 回答