現在取り組んでいるかなり長くて複雑な SQL クエリがあります。
私がやりたいことは追加するだけLIMIT 10
です...しかし、クエリの最後まで終了するたびにエラーが発生します。
クエリは次のとおりです。
sqlQuery = "
select DATENAME(Month,i.Datecreated) + ' ' +
DATENAME(day,i.Datecreated) + ' ' +
DATENAME(year,i.Datecreated) AS USDateCreated,
i.imageId,
GalleryName,Fullpath,MediumPath,ThumbPath,ViewCounter,
i.DateCreated,ItemNumber,Gender,Minutes,
right(convert(varchar(3), 100 + Seconds),2) as Seconds,
FramesPerSecond,WeekNumber,Filename,
(round(cast(Size as Decimal(16,2))/1024,2)) as Size,
FlvFilename,FlvSize,NumberOfMovies,
Free,Comment,
(case when sum(rating)/count(i.imageId) is null then 0 else sum(rating)/count(i.imageId) end) as ratingResult,
dbo.getTagNames(i.imageid) as tagsname,'' as yourTagNames,
dbo.getTagNames(i.imageid) as memberTagNames,max(weekNumber)-1 as lastWeek
from images as i
left join Imagerating as ir on i.imageId = ir.imageId
left join tag as t on i.imageId = t.imageId where 1=1
and galleryName = 'pictures'
and weekNumber = '4'
group by i.imageId,GalleryName,Fullpath,MediumPath,ThumbPath,
ViewCounter,i.DateCreated,ItemNumber,Gender,Minutes,Seconds,
FramesPerSecond,WeekNumber,Filename,Size,FlvFilename,FlvSize,
NumberOfMovies,Free,Comment
order by filename
"