var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Query Help - Selecting between two date ranges
I am trying to count rows in a table where a datetime field entry is between todays date and the previous 14 days.
This doesn't return any results, I am not sure if I am using the correct date format?
WHERE DateInvoiced between dateadd(day,datediff(day,0,getdate())-0,0) and dateadd(day,datediff(day,0,getdate())-14,0)
I am also trying to do a SUM on a field within the same table but when I attempt to select both a COUNT and a SUM within the same query I get the following error:
Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.
Sorry if this is a basic question or has been asked before, I'm new to SQL and would really appreciate the guidance.
if you run this you'll see your formulae are fine, but you have the dates in the wrong order for the BETWEEN arguments.
I can't help with the second problem without the SQL.