本文介绍了我如何按查询编写组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
ALTER PROCEDURE [dbo].[searchJobs]
--[dbo].[GetImagesPageWise] 2, 10, null
@PageIndex INT = 1
,@PageSize INT = 3
,@RecordCount int OUTPUT
,@keyword nvarchar
AS
BEGIN
SET NOCOUNT ON;
SELECT ROW_NUMBER() OVER (ORDER BY Job_id DESC) AS RowNumber
,Job_id ,substring(PostJobs.Exp_JobDescription,1,200)+ '...' AS ShortJobDescription
,Job_Title ,Job_NoOfPosition ,Ad_Image ,Exp_JobDescription
,Job_ApplyBefore ,PostDate ,Job_SallaryFrom, Job_SallaryTo
,Job_SallaryType ,Jobs_PostType ,Exp_DegreeTitle ,Exp_CarrerLevel
,Company_Logo ,Country_Name ,Company_Registeration.Company_Verified
INTO #Results
FROM PostJobs,Company_Registeration, Country
where PostJobs.Company_id=Company_Registeration.Company_id
and (((PostJobs.Job_Title like '%'+IsNull(@keyword,PostJobs.Job_Title)+'%')))
SELECT @RecordCount = COUNT(*) FROM #Results
SELECT * FROM #Results
WHERE RowNumber BETWEEN(@PageIndex -1) * @PageSize + 1 AND(((@PageIndex -1) * @PageSize + 1) + @PageSize) - 1
DROP TABLE #Results
END
推荐答案
(eg. you need to group the employee records on country basis means all employee belonging to same country comes in one group).
to write the group by query group by clause is used
。
- 并且对于resule的填充,必须通过聚合函数在select子句中使用。
如Sum(),count(),avg()等..
.
- and for grouing the resule, there must by aggregate function is to be used in select clause.
like Sum(), count(),avg() etc..
这篇关于我如何按查询编写组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!