﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Article Discussions / Article Discussions by Author / Discuss content posted by RBarryYoung  / SUM not working???? / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 22 May 2013 19:18:38 GMT</lastBuildDate><ttl>20</ttl><item><title>SUM not working????</title><link>http://www.sqlservercentral.com/Forums/Topic1007823-1226-1.aspx</link><description>RiderID_PK|	StartDate  |	EndDate	  |     RouteID_FK|	Expr1|	FriDate|	            Total|27	 |         10/14/2004 |	5/23/2010 |	107|	107|	1/15/2010|	28.8|29	 |          10/14/2004|	NULL	  |          107|	107|	1/15/2010|	17.28|32	 |          10/14/2004|	3/14/2010 |	107|	107|	1/15/2010|	28.8|33	 |          10/14/2004|	NULL	  |          107|	107|	1/15/2010|	23.04|35	 |          10/14/2004|	NULL	  |          107|	107|	1/15/2010|	17.28|36	 |          10/14/2004|	5/2/2010	  |          107|	107|	1/15/2010|	28.8|780	 |          7/8/2006	  |	NULL        |           107|	107|	1/15/2010|	28.8|1178	 |          4/22/2007  |	NULL	 |           107|	107|	1/15/2010|	28.8|1272	 |          7/8/2007	  |	NULL        |           107|	107|	1/15/2010|	28.8|1661	 |          2/1/2009	  |           5/2/2010 |	 107|	107|	1/15/2010|	28.8|1851	 |          10/11/2009|	NULL	  |           107|	107|	1/15/2010|	28.8|1852	 |          10/11/2009|	9/19/2010 |	107|	107|	1/15/2010|	28.8|[b]Those are the result I get when I run this query:[/b]SELECT     Rider.RiderID_PK, Rider.StartDate, Rider.EndDate, Rider.RouteID_FK, Rider.RouteID_FK AS Expr1, RiderFareHistory.FriDate,                       SUM(RiderFareHistory.AmountPaid) AS TotalFROM         Rider INNER JOIN                      RiderFareHistory ON Rider.RiderID_PK = RiderFareHistory.RiderID_FKWHERE     (RiderFareHistory.FriDate = CONVERT(DATETIME, '2010-01-15 00:00:00', 102)) AND (Rider.RouteID_FK = '107') AND                       (Rider.EndDate &amp;gt; CONVERT(DATETIME, '2010-01-15 00:00:00', 102) OR                      Rider.EndDate IS NULL) AND (Rider.StartDate &amp;lt; CONVERT(DATETIME, '2010-01-15 00:00:00', 102))GROUP BY Rider.RiderID_PK, Rider.RouteID_FK, RiderFareHistory.FriDate, Rider.EndDate, Rider.StartDate[b]I need to SUM all the values in the AmountPaid Column.What am I doing wrong????[/b]Sorry for the formatting. I attatched a photo of the query and the results.Thank YouMutlyP</description><pubDate>Wed, 20 Oct 2010 09:23:01 GMT</pubDate><dc:creator>mutlyp</dc:creator></item></channel></rss>