Click here to Skip to main content
15,919,341 members
Home / Discussions / Database
   

Database

 
QuestionOLEDB network failure recovery problem. Pin
CherezZaboro29-Jun-09 6:57
CherezZaboro29-Jun-09 6:57 
QuestionEncryptbyKey VARCHAR(50) Pin
Saamir29-Jun-09 6:42
Saamir29-Jun-09 6:42 
QuestionMy Sql Query Help Pin
Hulicat29-Jun-09 6:26
Hulicat29-Jun-09 6:26 
AnswerRe: My Sql Query Help Pin
Niladri_Biswas29-Jun-09 6:54
Niladri_Biswas29-Jun-09 6:54 
GeneralRe: My Sql Query Help Pin
Hulicat29-Jun-09 11:23
Hulicat29-Jun-09 11:23 
GeneralRe: My Sql Query Help [modified] Pin
Niladri_Biswas29-Jun-09 19:33
Niladri_Biswas29-Jun-09 19:33 
GeneralRe: My Sql Query Help Pin
Hulicat1-Jul-09 7:06
Hulicat1-Jul-09 7:06 
AnswerRe: My Sql Query Help Pin
smcnulty200029-Jun-09 21:19
smcnulty200029-Jun-09 21:19 
If you want to solve a problem like this; sometimes you can figure out what is going on by running a similar query to the one you do have but instead of using SUM use COUNT. This is just a debugging method, not the solution.

I suspect if you did that with your original query all of the lines that you saw double would come out with a count of 2 or higher.

Maybe you should try something more like this for your query:

select 
spend.account,
spend.fromcode,
spend.keyword,
spend.kwtype, 
(select sum(rev.trans) from rev where rev.fromcode=spend.fromcode) trans, 
(select sum(rev.newaccounts) from rev where rev.fromcode=spend.fromcode) newaccounts, 
(select sum(rev.gross) from rev where rev.fromcode=spend.fromcode) gross,
(select sum(rev.refunds) from rev where rev.fromcode=spend.fromcode) refunds,
(select sum(rev.net) from rev where rev.fromcode=spend.fromcode) net, 
spend.clicks, 
spend.spend
from spend 
order by spend.fromcode


I don't have mysql running so I can't test it myself.

_____________________________
When life hands you marmots, make marmalade.



GeneralRe: My Sql Query Help Pin
Hulicat30-Jun-09 3:59
Hulicat30-Jun-09 3:59 
GeneralRe: My Sql Query Help Pin
Hulicat30-Jun-09 7:30
Hulicat30-Jun-09 7:30 
QuestionHow to Optimize DbTransactions (C#) with SQLServer ? Pin
kadaoui el mehdi29-Jun-09 4:55
kadaoui el mehdi29-Jun-09 4:55 
AnswerRe: How to Optimize DbTransactions (C#) with SQLServer ? Pin
Enver Maroshi29-Jun-09 7:10
Enver Maroshi29-Jun-09 7:10 
GeneralRe: How to Optimize DbTransactions (C#) with SQLServer ? Pin
kadaoui el mehdi29-Jun-09 7:32
kadaoui el mehdi29-Jun-09 7:32 
AnswerRe: How to Optimize DbTransactions (C#) with SQLServer ? Pin
Niladri_Biswas30-Jun-09 5:50
Niladri_Biswas30-Jun-09 5:50 
Questionon full-text-search Pin
leone29-Jun-09 4:47
leone29-Jun-09 4:47 
Questionho to retrieve a list of dependants Pin
Anoop Brijmohun29-Jun-09 2:59
Anoop Brijmohun29-Jun-09 2:59 
AnswerRe: ho to retrieve a list of dependants [modified] Pin
Niladri_Biswas29-Jun-09 23:59
Niladri_Biswas29-Jun-09 23:59 
GeneralRe: ho to retrieve a list of dependants Pin
Anoop Brijmohun5-Jul-09 20:16
Anoop Brijmohun5-Jul-09 20:16 
QuestionConvert String and Sort the the Intergers in a String ASC Pin
Vimalsoft(Pty) Ltd29-Jun-09 0:31
professionalVimalsoft(Pty) Ltd29-Jun-09 0:31 
AnswerRe: Convert String and Sort the the Intergers in a String ASC Pin
Aman Bhullar29-Jun-09 2:20
Aman Bhullar29-Jun-09 2:20 
GeneralRe: Convert String and Sort the the Intergers in a String ASC Pin
Vimalsoft(Pty) Ltd29-Jun-09 2:25
professionalVimalsoft(Pty) Ltd29-Jun-09 2:25 
GeneralRe: Convert String and Sort the the Intergers in a String ASC Pin
Aman Bhullar29-Jun-09 3:06
Aman Bhullar29-Jun-09 3:06 
GeneralRe: Convert String and Sort the the Intergers in a String ASC Pin
Vimalsoft(Pty) Ltd29-Jun-09 3:21
professionalVimalsoft(Pty) Ltd29-Jun-09 3:21 
AnswerRe: Convert String and Sort the the Intergers in a String ASC [modified] Pin
Niladri_Biswas29-Jun-09 5:45
Niladri_Biswas29-Jun-09 5:45 
GeneralRe: Convert String and Sort the the Intergers in a String ASC Pin
Vimalsoft(Pty) Ltd29-Jun-09 5:48
professionalVimalsoft(Pty) Ltd29-Jun-09 5:48 

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.