Solved

get username and the com1+com2 fields and then sum them for the entire user id in sql server

Posted on 2014-11-05
2
78 Views
Last Modified: 2014-11-11
get username and the com1+com2 fields and then sum them for the entire user id in sql server
0
Comment
Question by:cbrune
2 Comments
 
LVL 65

Expert Comment

by:Jim Horn
ID: 40425311
What's a 'com1+com2' fields?

SELECT SUSER_NAME() as login_name, USER_NAME() as user_name
0
 
LVL 49

Accepted Solution

by:
Vitor Montalvão earned 500 total points
ID: 40428561
It's hard to understand the question but I'll try to guess that you want a SUM of fields grouped by users:
SELECT id, name, SUM(com1+com2)
FROM TableNameHere
GROUP BY id, name

Open in new window

0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Search query matching words 20 38
SQL that will turn the rows in to columnsin date format 28 52
Moving a large MS Sql Database 5 51
SQL Job Hung 17 35
When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question