Priyan RockZ Priyan RockZ - 4 years ago 178
SQL Question

How to get current month records from ORACLE since first date.?

here is my code

SELECT h.ENTERED_DATE,
d.DENOMINATION,
sum(h.invoice_total-h.TOTTAL_DISCOUNT)as amount
FROM sales_details d
LEFT JOIN sales_header h
ON d.invoice_id=h.invoice_id
WHERE entered_by='2254'
--HERE IS NEED TO GET DETAILS CURRENT MONTH 1st Date to Sysdate
GROUP BY
ENTERED_DATE,
d.DENOMINATION
ORDER BY
entered_date,
denomination



  • In my application just send only sysdate as parameter.
    no need to SYSDATE-30.
    need 1st date to SYSDATE



here shows my two tables
sales_header table
enter image description here

sales_details table
enter image description here

Answer Source

try this:

WHERE entered_by='2254'
AND ENTERED_DATE BETWEEN trunc (sysdate, 'mm')/*current month*/ AND SYSDATE
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download