User Profile

Collapse

Profile Sidebar

Collapse
sanjhan
sanjhan
Last Activity: Jul 19 '10, 08:22 AM
Joined: Jul 13 '10
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • sanjhan
    replied to Multiple Sum() values with GROUP BY Problem
    Hi ,
    I really appreciate your quick response,
    anyway the problem was,I have missed the 'DISTINCT'keywo rd in every SUM() function,I can re-write the solution as follows, which gives me the exact functionality I need.

    Thank you.

    Code:
    SELECT DISTINCT U.date,SUM(DISTINCT I.amount)AS 'Income' ,SUM(DISTINCT A.amount) AS 'Cost' 
    
    FROM 
    (SELECT date from `income`GROUP BY date 
    UNION
    ...
    See more | Go to post

    Leave a comment:


  • sanjhan
    started a topic Multiple Sum() values with GROUP BY Problem

    Multiple Sum() values with GROUP BY Problem

    Hi,
    I am a newbie to sql,I have a problem with querying the intended result.What i need is to get the SUM() of daily income,cost im my result set, but it gives me unintended result set hence it gets duplicated by GROUP BY clause.please correct my sql.
    Thank you.

    this is what i want

    +------------+--------+------+
    | date | Income | Cost |
    +------------+--------+------+
    | 2010-05-12...
    See more | Go to post
No activity results to display
Show More
Working...