Click here to Skip to main content
16,006,442 members
Home / Discussions / Database
   

Database

 
GeneralADO.NET Pin
sreemurali9-Dec-03 10:59
sreemurali9-Dec-03 10:59 
GeneralADO.NET Pin
sreemurali9-Dec-03 10:59
sreemurali9-Dec-03 10:59 
GeneralDatasets Pin
Mohan BV8-Dec-03 22:11
Mohan BV8-Dec-03 22:11 
GeneralRe: Datasets Pin
gokselm16-Dec-03 23:32
gokselm16-Dec-03 23:32 
Questionhow can i use ado to open mdb file In Visual basic6 Pin
meirav8-Dec-03 8:32
meirav8-Dec-03 8:32 
GeneralRe: how can i use ado to open mdb file In Visual basic6 Pin
Mike Dimmick9-Dec-03 3:13
Mike Dimmick9-Dec-03 3:13 
Generalcombining agregate function with select statements Pin
Petu7-Dec-03 9:49
Petu7-Dec-03 9:49 
GeneralRe: combining agregate function with select statements Pin
Colin Angus Mackay7-Dec-03 14:20
Colin Angus Mackay7-Dec-03 14:20 
Is User_Id your primary key?

Two ways:

1. User_Id is your primary key then:

SELECT (MSD + Methods + Analysis + Architectures + Models + 
    Studio + Elective1 + Elective2 + Elective3) As PersonTotals, 
    FirstName, LastName, WeekNo, ProgramName, StudioTeamName
FROM tblpersons


2. User_Id is NOT your primary key

SELECT SUM(MSD + Methods + Analysis + Architectures + Models + 
    Studio + Elective1 + Elective2 + Elective3) As PersonTotals, 
    FirstName, LastName, WeekNo, ProgramName, StudioTeamName
FROM tblpersons
GROUP BY FirstName, LastName, WeekNo, ProgramName, StudioTeamName


Without knowing more about your datamodel I can't guarantee they they will produce the expected results.

Where you appeared to be going wrong was that the SUM() function is an aggregator function (It operates on lots of records). If User_Id was your primary key then it was operating on only one record so there was nothing to aggretate. If User_Id was not your primary key then you need to specify the fields to GROUP BY that you want to output but are not part of the input to the aggretate function.


--Colin Mackay--

"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown)

Enumerators in .NET: See how to customise foreach loops with C#


GeneralConcurrency issues in databases Pin
Shah Shehpori4-Dec-03 18:56
sussShah Shehpori4-Dec-03 18:56 
Questionis it possible to create a database in the client side for a windows based using visual studio .NET? Pin
Anonymous4-Dec-03 13:20
Anonymous4-Dec-03 13:20 
AnswerRe: is it possible to create a database in the client side for a windows based using visual studio .NET? Pin
Colin Angus Mackay7-Dec-03 14:03
Colin Angus Mackay7-Dec-03 14:03 
QuestionTrouble with an SQL statement...maybe syntax related? Pin
frank214-Dec-03 8:24
frank214-Dec-03 8:24 
AnswerRe: Trouble with an SQL statement...maybe syntax related? Pin
Chris Meech9-Dec-03 7:16
Chris Meech9-Dec-03 7:16 
QuestionHow to figure out database type in ADO or ODBC? Pin
CherezZaboro4-Dec-03 8:12
CherezZaboro4-Dec-03 8:12 
AnswerAnyone? Pin
CherezZaboro5-Dec-03 3:04
CherezZaboro5-Dec-03 3:04 
AnswerRe: How to figure out database type in ADO or ODBC? Pin
Mike Dimmick5-Dec-03 4:53
Mike Dimmick5-Dec-03 4:53 
GeneralMS-SQL: Removing all database ownership for one login Pin
Carl Mercier3-Dec-03 15:03
Carl Mercier3-Dec-03 15:03 
GeneralFile retrieval methods Pin
joe.A3-Dec-03 5:01
joe.A3-Dec-03 5:01 
GeneralRe: File retrieval methods Pin
Rob Graham9-Dec-03 4:38
Rob Graham9-Dec-03 4:38 
GeneralCreating a new database... Pin
Amirjalaly3-Dec-03 2:56
Amirjalaly3-Dec-03 2:56 
GeneralRe: Creating a new database... Pin
Rob Graham9-Dec-03 4:45
Rob Graham9-Dec-03 4:45 
GeneralRows Pin
Anonymous2-Dec-03 9:36
Anonymous2-Dec-03 9:36 
GeneralRe: Rows Pin
Colin Angus Mackay3-Dec-03 15:27
Colin Angus Mackay3-Dec-03 15:27 
GeneralAdding numbers in Access DB displaying the results via ASP page Pin
Petu1-Dec-03 10:14
Petu1-Dec-03 10:14 
GeneralMSDE Configuration Tool Pin
Rocky Moore1-Dec-03 9:44
Rocky Moore1-Dec-03 9:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.