Click here to Skip to main content
15,891,473 members
Home / Discussions / Database
   

Database

 
GeneralRe: Filtering on a variable in SQL Pin
Stuck !16-Apr-05 22:09
sussStuck !16-Apr-05 22:09 
GeneralRe: Filtering on a variable in SQL Pin
Colin Angus Mackay16-Apr-05 23:44
Colin Angus Mackay16-Apr-05 23:44 
GeneralRe: Filtering on a variable in SQL Pin
Anonymous17-Apr-05 4:43
Anonymous17-Apr-05 4:43 
GeneralRe: Filtering on a variable in SQL [another wee hint] Pin
Colin Angus Mackay16-Apr-05 6:23
Colin Angus Mackay16-Apr-05 6:23 
QuestionExecute SQL file in Enterprise Manager? Pin
c121hains15-Apr-05 13:10
c121hains15-Apr-05 13:10 
AnswerRe: Execute SQL file in Enterprise Manager? Pin
djkno315-Apr-05 13:29
djkno315-Apr-05 13:29 
GeneralSum on a portion of a column Pin
Esmo200015-Apr-05 9:50
Esmo200015-Apr-05 9:50 
GeneralRe: Sum on a portion of a column Pin
Colin Angus Mackay15-Apr-05 9:57
Colin Angus Mackay15-Apr-05 9:57 
Use the GROUP BY clause.
SELECT Name, SUM(Value)
FROM MyTable
GROUP BY Name
If you need the output to be like the table you have above, you will need to create a subquery and join to it, like this:
SELECT Name, Value, GroupValue
FROM MyTable
INNER JOIN (SELECT Name, SUM(Value) AS GroupValue
    FROM MyTable
    GROUP BY Name) AS Group ON Group.Name = MyTable.Name


Does this help?


My: Blog | Photos | Next SQL Presentation
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More


GeneralDatabase SQL Syntax Comparison Pin
loane15-Apr-05 8:02
loane15-Apr-05 8:02 
GeneralRe: Database SQL Syntax Comparison Pin
loane15-Apr-05 8:18
loane15-Apr-05 8:18 
GeneralAS400 Connection using ADO.Net Pin
directred15-Apr-05 4:49
directred15-Apr-05 4:49 
GeneralRe: AS400 Connection using ADO.Net Pin
Colin Angus Mackay15-Apr-05 11:47
Colin Angus Mackay15-Apr-05 11:47 
GeneralExport ms sql server 2005 to .sql Pin
djkno315-Apr-05 3:55
djkno315-Apr-05 3:55 
GeneralRe: Export ms sql server 2005 to .sql Pin
Colin Angus Mackay15-Apr-05 11:49
Colin Angus Mackay15-Apr-05 11:49 
GeneralRe: Export ms sql server 2005 to .sql Pin
djkno315-Apr-05 13:27
djkno315-Apr-05 13:27 
GeneralRe: Export ms sql server 2005 to .sql Pin
Colin Angus Mackay15-Apr-05 23:16
Colin Angus Mackay15-Apr-05 23:16 
GeneralRe: Export ms sql server 2005 to .sql Pin
djkno316-Apr-05 3:51
djkno316-Apr-05 3:51 
GeneralRe: Export ms sql server 2005 to .sql Pin
Mike Dimmick18-Apr-05 1:09
Mike Dimmick18-Apr-05 1:09 
GeneralRe: Export ms sql server 2005 to .sql Pin
djkno318-Apr-05 1:25
djkno318-Apr-05 1:25 
GeneralColumn <Name> does not belong to Table <name> exception Pin
GostWryter15-Apr-05 2:36
GostWryter15-Apr-05 2:36 
GeneralRe: Column <Name> does not belong to Table <name> exception Pin
Colin Angus Mackay15-Apr-05 9:53
Colin Angus Mackay15-Apr-05 9:53 
GeneralRe: Column <Name> does not belong to Table <name> exception Pin
Luis Alonso Ramos15-Apr-05 11:15
Luis Alonso Ramos15-Apr-05 11:15 
GeneralRe: Column <Name> does not belong to Table <name> exception Pin
Colin Angus Mackay15-Apr-05 11:43
Colin Angus Mackay15-Apr-05 11:43 
GeneralRe: Column <Name> does not belong to Table <name> exception Pin
GostWryter16-Apr-05 2:56
GostWryter16-Apr-05 2:56 
GeneralReporting Service Pin
sukasukabo15-Apr-05 1:40
sukasukabo15-Apr-05 1:40 

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.