mysql - WHERE clause causing table to omit LEFT JOIN rule -


I'm essentially trying to modify the stored procedure.

Modified stored procedure:

  Start process sp1 (d1 date, d2 date, customer int (10)) date date declared; Floating table made Fu (D date not zero, zodiac INT (10) DEFAULT 0); Set D = D1; While D & lt; = D2 into Fu (D) values ​​(D); Set d = date_add (d, interval 1 day); End time; SELECT SUM (p.Amount), foo Foo to Foo LEFT JOIN ItemTracker_dbo.Payment ON foo.d = p.Datetime WHERE p.ClientId = ClientId GROUP by foo.d; DROP floating table foo; End process  

Note: WHERE clause ... p.ClientId = client

I was trying to understand my mind That's why it was sacrificing zero.

The WHERE p.ClientId = client process on deletion returned to zero ...

Why were the blank lines removed? is? I have a misunderstanding that absolutely is a LEFT JOIN .

How can I go about filtering SUM (p.Amount) only the amount for the results WHERE clientId = customer

Returns it if you enter all the conditions in the LEFT JOIN condition:

/ P>
  SELECT SUM (p.Amount), foo.d Foo LEFT JOIN ItemTracker_dbo.Payment p ON foo.d = p.Datetime and p.ClientId = foo.d by ClientId Group;  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -