Bruce Gust
asked on
What's the difference between these two queries?
This query gives me 10,185
select SUM(int_BenefitEquation) AS total_hours from net_BudgetTools..tbl_DEVEL OPERS_Proj ects where dte_DateOnProduction<='201 5-04-07'
This query gives me 9,075
SELECT SUM(ISNULL(int_BenefitEqua tion, 0)) AS BenefitHours FROM net_BudgetTools..tbl_DEVEL OPERS_Proj ects
WHERE
DATEPART(year, dte_DateOnProduction) = '2015'
What's the difference? Basically, I want all of the projects that went into production this year. What's the difference between these two queries that I would wind up with two different figures?
select SUM(int_BenefitEquation) AS total_hours from net_BudgetTools..tbl_DEVEL
This query gives me 9,075
SELECT SUM(ISNULL(int_BenefitEqua
WHERE
DATEPART(year, dte_DateOnProduction) = '2015'
What's the difference? Basically, I want all of the projects that went into production this year. What's the difference between these two queries that I would wind up with two different figures?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
<Not an answer, but...>
brucegust - SQL expert PorletPaul's article titled Beware of Between would be an excellent read for your situation.
brucegust - SQL expert PorletPaul's article titled Beware of Between would be an excellent read for your situation.
Open in new window