I'm building a report for my boss and he wants the report to display a field that has the minimum value of all minimal values for 5 min fields.
so for example,
when i run this query -
Select v.evalrecno, dbo.idtoname(evalteeid)as Faculty, min(q1)as min1,min(q2) as min2,min(q3) as min3,min(q4) as min4,min(q5) as min5, count(*) N from viewr507 v, viewevalissue i, employee e
where v.evalrecno = I.recno
and e.eid = i.evalteeid
and acyear=2007
and rotation between 1 and 12
group by v.evalrecno,evalteeid,acyear,q1,q2,q3,q4,q5
order by 2
and it brings me back each faculty's minimal scores per question (q1-q5), I need to pull the min from those. . . . is that possible?
1 1179
I don't see data to help you better.
So try this:
1. Create Function: - Create function fGetMin(@A1 int, @A2 int, @A3 int, @A4 int, @A5 int)
-
Returns int
-
AS
-
BEGIN
-
Declare @Res int
-
Select @Res = min(Col)
-
From (Select @A1 Col
-
Union
-
Select @A2
-
Union
-
Select @A3
-
Union
-
Select @A4
-
Union
-
Select @A5) Tmp
-
Return @Res
-
END
2. Execute your statement: - Select v.evalrecno, dbo.idtoname(evalteeid)as Faculty,
-
dbo.fGetMin (min(q1),min(q2),min(q3),min(q4),min(q5)), count(*) N
-
from viewr507 v, viewevalissue i, employee e
-
where v.evalrecno = I.recno
-
and e.eid = i.evalteeid
-
and acyear=2007
-
and rotation between 1 and 12
-
group by v.evalrecno,evalteeid,acyear,q1,q2,q3,q4,q5
-
order by 2
Good Luck.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Jeff Wagner |
last post by:
I am in the process of learning Python (obsessively so). I've been through a few tutorials and read
a Python book that was lent to me. I am now trying to put what I've learned to use by rewriting...
|
by: JustSomeGuy |
last post by:
I need to write an new class derived from the list class.
This class stores data in the list to the disk if an object
that is added to the list is over 1K in size.
What methods of the std stl...
|
by: brian.digipimp |
last post by:
Write a program that prompts the user to input a positive integer. It
should then output a message indicating whether the number is a prime
number. (Note: An even number is prime if it is 2. An odd...
|
by: Timothy Shih |
last post by:
Hi, I am trying to figure out how to use unmanaged code using P/Invoke. I
wrote a simple function which takes in 2 buffers (one a byte buffer, one a
char buffer) and copies the contents of the byte...
|
by: fox |
last post by:
Hi,
Lacking javascript knowledge, I just realized why my project has a bug.
I am using ASP to loop through a set of records while it creates URLs
with a querystring that has a single value pair....
|
by: |
last post by:
The problem lies here eval("document.TeeForm.amt.value(S+M)");
S and M suppose to add up and the total suppose to appear on the AMT field
but it didn't. Any help?
...
|
by: lcdgoncalves |
last post by:
Hi everyone
Is there a real need to use keyword static with functions, if we
simply don't declare their prototypes in .h file?
Many textbooks avoid to discuss this matter and/or discuss only...
|
by: Anders B |
last post by:
I want to make a program that reads the content of a LUA array save file..
More precicely a save file from a World of Warcraft plugin called
CharacterProfiler, which dumps alot of information about...
|
by: pereges |
last post by:
Hello I need some ideas for designing a recursive function for my ray
tracing program.
The idea behind ray tracing is to follow the electromagnetic rays from
the source, as they hit the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |