Not being good with complex sql statements, I'm looking for help with the following: I need to create a report that will display revenue data for accounts that DO NOT have revenue for the previous year. The following query doesn't work.
SELECT DISTINCT a.LDGACT, a.ACCTNAME, SUM(f.REVENUE) AS REVENUE
FROM FORD.dbo.DATA f, FORD.dbo.ACCOUNT a, FORD.dbo.DATE d
WHERE (d.YEAR = '2005') AND (d.YEAR <> '2004')
GROUP BY a.ACCTNBR, a.ACCTNAME
Since the DATE table contains the "year" value, is there a way to create the limitation to show the correct results (only accounts with 2005 data that DID NOT have 2004 data)?
SELECT DISTINCT a.LDGACT, a.ACCTNAME, SUM(f.REVENUE) AS REVENUE
FROM FORD.dbo.DATA f, FORD.dbo.ACCOUNT a, FORD.dbo.DATE d
WHERE (d.YEAR = '2005') AND (d.YEAR <> '2004')
GROUP BY a.ACCTNBR, a.ACCTNAME
Since the DATE table contains the "year" value, is there a way to create the limitation to show the correct results (only accounts with 2005 data that DID NOT have 2004 data)?