Advertisement

05.12.2008 at 12:53PM PDT, ID: 23395742
[x]
Attachment Details

help with sql query -multiple agregate functions

Asked by YZlat in MS SQL Server, SQL Query Syntax

I have the following tables

Computer
_________
ComputerID
ComputerName


Product
_________
ProductID
ProductName



ComputerProduct
________________
ComputerID
ProductID


ProductFile
___________
ProductID
FileID



File
_______
FileID


FileInfo
__________
FileInfoID
FileID
ComputerID
LastUsed
LastUser
AccessNum
DirationInSeconds
DateDiscovered

FileInfo connected to Computer table through ComputerID
and to File table through FileID

FileInfo table can contain multiple records for the dame computerID

I need to retrieve a computer name from Computer Table Where Computer is linked with Product table through ComputerProduct table and where ProductName IN ('Test1','Test2','Test3").

Also, in the same select statement I need to retrieve the following values from FileInfo table:

MAX(LastUsed),
LastUser,
SUM(AccessNum),
SUM(DirationInSeconds)/60 as DurationInMinutes,
and MAX(DateDiscovered)

I need one record per each computer.

Can someone help?Start Free Trial
[+][-]05.12.2008 at 01:14PM PDT, ID: 21550156

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.12.2008 at 01:30PM PDT, ID: 21550265

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.12.2008 at 01:34PM PDT, ID: 21550287

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.12.2008 at 01:36PM PDT, ID: 21550309

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.12.2008 at 02:34PM PDT, ID: 21550705

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.13.2008 at 12:30AM PDT, ID: 21552928

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: MS SQL Server, SQL Query Syntax
Sign Up Now!
Solution Provided By: yuching
Participating Experts: 2
Solution Grade: A
 
 
[+][-]05.13.2008 at 06:34AM PDT, ID: 21554862

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.13.2008 at 06:56AM PDT, ID: 21555035

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.13.2008 at 07:52AM PDT, ID: 21555626

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.13.2008 at 07:55AM PDT, ID: 21555656

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.14.2008 at 01:16AM PDT, ID: 21562013

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.14.2008 at 07:32AM PDT, ID: 21564617

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.14.2008 at 06:19PM PDT, ID: 21569988

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628