select top 1 PictureID,caption from Pictures where Left(PictureID,6) in (
Select Left(PictureID,6) PictureID
from Pictures aa where exists (Select 1 from PictureDetails where PictureID=aa.PictureID) and AuditMark='1' and left(PictureID,2)='00'
and Caption like '%" + Request.Params["cont"] + "%' or Contents like '%" + Request.Params["cont"] + "%'
Group by Left(PictureID,6)) order by AuditDate Desc
Select Left(PictureID,6) PictureID
from Pictures aa where exists (Select 1 from PictureDetails where PictureID=aa.PictureID) and AuditMark='1' and left(PictureID,2)='00'
and Caption like '%" + Request.Params["cont"] + "%' or Contents like '%" + Request.Params["cont"] + "%'
Group by Left(PictureID,6)) order by AuditDate Desc
也不对呀System.Data.SqlClient.SqlException: Column name 'Pictures.AuditDate' is invalid in the ORDER BY clause because it is not contained in either an aggregate function or the GROUP BY clause.
aa='Select Top 1 PictureID,Caption from Pictures where PictureID In(Select PictureID from PictureDetails) and AuditMark='1' and left(PictureID,2)='00' and Caption like '%" + Request.Params["cont"] + "%' or Contents like '%" + Request.Params["cont"] + "%' Group by Left(PictureID,6) order by AuditDate Desc'再运行你的aa,
声明,本贴已由SophiaWang为我解决,现全分奉送!