Avatar of Jeremy Kirkbride
Jeremy Kirkbride
 asked on

SQL DATE filter on sales history

I am trying to write a simple SQL query that sums a salesman sales by month, but the date seems to be my trouble.

What I need to see is summed sales by salesman for a particular month/year 11-2013


SELECT HDR.slspsn_no,SUM(LIN.sls_amt)
FROM oehdrhst_sql HDR
INNER JOIN oelinhst_sql LIN ON
HDR.inv_no=LIN.inv_no
WHERE HDR.inv_dt=(11-2013)
GROUP BY HDR.slspsn_no

As the above is written I get (0 row(s) affected)

Any help would be much appreciated
Programming Languages-Other

Avatar of undefined
Last Comment
Jeremy Kirkbride

8/22/2022 - Mon
Sharath S

You need to extract only month/ year from the date field before applying the filter. What is your database?
Jeremy Kirkbride

ASKER
SQL
Sharath S

SQL is not a database. I have asked if you are working in SQL Server/Oracle/DB2/MySQL or any other database?
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Jeremy Kirkbride

ASKER
SQL Server 2012, but I am writing a query with SQL Server Management Studio. That help?
ASKER CERTIFIED SOLUTION
Sharath S

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Jeremy Kirkbride

ASKER
Thanks so much, exactly what I needed. I'm sure simple for you, but I'm new to SQL