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

Database

 
QuestionWhich local datasource to use? [modified] Pin
Rashar10-Jul-06 13:44
Rashar10-Jul-06 13:44 
AnswerRe: Which local datasource to use? Pin
god_bless_the_world10-Jul-06 13:56
god_bless_the_world10-Jul-06 13:56 
QuestionError with INSERT statement Pin
leckey10-Jul-06 11:09
leckey10-Jul-06 11:09 
AnswerRe: Error with INSERT statement Pin
Colin Angus Mackay10-Jul-06 12:13
Colin Angus Mackay10-Jul-06 12:13 
QuestionGetting the SUM of two field values [modified] Pin
Nino_110-Jul-06 9:06
Nino_110-Jul-06 9:06 
AnswerRe: Getting the SUM of two field values Pin
Eric Dahlvang10-Jul-06 9:16
Eric Dahlvang10-Jul-06 9:16 
GeneralRe: Getting the SUM of two field values Pin
Nino_110-Jul-06 11:44
Nino_110-Jul-06 11:44 
GeneralRe: Getting the SUM of two field values Pin
Eric Dahlvang10-Jul-06 12:00
Eric Dahlvang10-Jul-06 12:00 
Yeah, you can't do that. If you want to sum all amount and debit columns for the entire table...then you wouldn't also pull back all the other fields. If you want to just add amount and debit together for each record, then you don't need a sum aggregate function.

select d.amount + d.debit as recsum, a.officer, d.amount,d.debit, 
e.fullesc as ESCROW_AND_CITY_CODE, e.open_date, e.close_date, e.ftype, 
a.street, a.city, a.state, a.zip
from escrow e inner join a10 a on e.escrow = a.escrow 
inner join e120 d on d.escrow = e.escrow and a.officer is not null 
order by e.open_date


declare @totalsum money
select @totalsum = sum(d.amount + d.debit)
from escrow e inner join a10 a on e.escrow = a.escrow 
inner join e120 d on d.escrow = e.escrow and a.officer is not null


or you could combine them like this - and every record will have a column with the TotalSum in it:
select (select sum(d2.amount + d2.debit)
     from escrow e2 inner join a10 a2 on e2.escrow = a2.escrow 
     inner join e120 d2 on d2.escrow = e2.escrow and a2.officer is not null) as totalsum,
d.amount + d.debit as recsum, a.officer, d.amount,d.debit, 
e.fullesc as ESCROW_AND_CITY_CODE, e.open_date, e.close_date, e.ftype, 
a.street, a.city, a.state, a.zip
from escrow e inner join a10 a on e.escrow = a.escrow 
inner join e120 d on d.escrow = e.escrow and a.officer is not null 
order by e.open_date



--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters

GeneralRe: Getting the SUM of two field values Pin
Nino_111-Jul-06 7:04
Nino_111-Jul-06 7:04 
Questionusing BETWEEN in sql2005 Pin
toink toink9-Jul-06 21:29
toink toink9-Jul-06 21:29 
AnswerRe: using BETWEEN in sql2005 Pin
Colin Angus Mackay9-Jul-06 23:39
Colin Angus Mackay9-Jul-06 23:39 
Questionhow to use now() function in the Access when I write SQL Pin
KSCsoft9-Jul-06 3:33
KSCsoft9-Jul-06 3:33 
AnswerRe: how to use now() function in the Access when I write SQL Pin
kumarprabhakar7410-Jul-06 1:14
kumarprabhakar7410-Jul-06 1:14 
AnswerRe: how to use now() function in the Access when I write SQL Pin
kumarprabhakar7410-Jul-06 1:15
kumarprabhakar7410-Jul-06 1:15 
QuestionData Source Reconciliation (Sybase) Pin
SSLaks9-Jul-06 1:41
SSLaks9-Jul-06 1:41 
Questionplease help me!!! Pin
kicap8-Jul-06 17:29
kicap8-Jul-06 17:29 
AnswerRe: please help me!!! Pin
Paul Conrad8-Jul-06 19:11
professionalPaul Conrad8-Jul-06 19:11 
AnswerRe: please help me!!! Pin
Eric Dahlvang10-Jul-06 3:26
Eric Dahlvang10-Jul-06 3:26 
Questionhow to update dataset after session cache? Pin
Ed 548-Jul-06 12:40
Ed 548-Jul-06 12:40 
AnswerRe: how to update dataset after session cache? Pin
Igor Sukhov9-Jul-06 0:24
Igor Sukhov9-Jul-06 0:24 
GeneralRe: how to update dataset after session cache? Pin
Ed 5410-Jul-06 8:35
Ed 5410-Jul-06 8:35 
QuestionAbout DataType in the access Pin
KSCsoft8-Jul-06 5:04
KSCsoft8-Jul-06 5:04 
AnswerRe: About DataType in the access Pin
Rob Graham8-Jul-06 5:27
Rob Graham8-Jul-06 5:27 
Questiontransaction Pin
md_refay8-Jul-06 3:27
md_refay8-Jul-06 3:27 
AnswerRe: transaction Pin
Rob Graham8-Jul-06 5:28
Rob Graham8-Jul-06 5:28 

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.