September 18, 2015 at 3:52 am
hello all,
I have a table with some rows and columns what i want is i want to Show sum of particular column in the last row.
this is my code.
SELECT DISTINCT Cluster.ClusterName, Gruppe.GruppeName, Arbeitspaket.ArbeitspaketName, BMWProjekt, AnzahlAP, Abgerechnet, InBearbeitung, Billanz FROM Bestellung
INNER JOIN Cluster ON Bestellung.Cluster = Cluster.rowid
INNER JOIN Arbeitspaket ON Bestellung.Arbeitspaket = Arbeitspaket.rowid
INNER JOIN Gruppe ON Bestellung.Gruppe = Gruppe.rowid
WHERE Projekt ="EA-284-Nxx" AND AnzahlAP <> 0 AND Abgerechnet is 1 AND InBearbeitung is NULL AND Billanz is NULL;
September 18, 2015 at 3:54 am
How about a table create script or some sample data, more importantly You can lookup MSDN since what your asking for a very basic t-SQL.
September 18, 2015 at 4:07 am
I have a table with some rows and columns what i want is i want to Show sum of particular column in the last row.
The last row of what? What client are you using?
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
September 18, 2015 at 5:46 am
Here is example you can make sum of column UserAge of table UserMaster as below and can do the same for as many column as you want.
select cast(usercode as varchar(10)) usercode, UserAge
from UserMaster
union all
select 'Total', sum(UserAge)
from UserMaster
September 18, 2015 at 6:37 am
You can use WITH ROLLUP, GROUPING SETS or other GROUP BY options.
More info: https://technet.microsoft.com/en-us/library/bb522495(v=sql.105).aspx
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply