Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to pull lowest two scores
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Posting Yak Master

154 Posts

Posted - 05/24/2010 :  16:44:43  Show Profile  Reply with Quote
I think I have a tough one here. I have written a query that pulls some survey results. The survey has 11 question. My query is working as I intend thus far:

use pdpadmin_dev
	'Center'					= cen.Centername,
	'Subsidiary'				= sub.Subsidiaryname,
	'Manager'					= su.managername, 
	'Supervisor'				= su.supervisorname,
	'Planning and Execution'	= cast(res.skills_planningexecution as float),
	'Time Management'			= cast(res.skills_timemanagement as float),
	'Continuous Improvement'	= cast(res.skills_continuousimprovemen as float),
	'Interpersonal Skills'		= cast(res.skills_interpersonal as float),
	'Communicaiton Skills'		= cast(res.skills_communication as float),
	'Leadership Skills'			= cast(res.skills_leadership as float),
	'Integrity'					= cast(res.culture_integrity as float),
	'Respect'					= cast(res.culture_respect as float),
	'Professionalism'			= cast(res.culture_professionalism as float),
	'Innovation'				= cast(res.culture_innovation as float),
	'Commitment'				= cast(res.culture_commitment as float)

	pdpadmin_dev..supervisor su
	INNER JOIN pdp..vw_results_67732 res on su.supervisorid = res.supervisorid and res.questionid=49
	INNER JOIN TPReports..info_center cen on =
	INNER JOIN TPReports..info_subsidiary sub on cen.subsidiaryid = sub.subsidiaryid
	cen.Centername, sub.Subsidiaryname, manager, supervisor

This lists all supervisor answers to the survey and orders them by location, manager, etc. Pretty straight forward.

But, my next task is to return the two lowest scores for each row. Technically I'm after the two categories of the lowest two scores. I'm not sure how to get there though. Can anyone help?


Craig Greenwood

Starting Member

20 Posts

Posted - 05/25/2010 :  02:31:44  Show Profile  Visit zstarsales04's Homepage  Reply with Quote
spam removed
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000