954,561 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Trying to pull and display records from today back 30 days....

Here's my code...basically, I hard coded yesterday just to make sure it works...Im trying to get it to display results everyday

String sqlStmt = "SELECT distinct count (lc.con_id) as TotalLeads FROM LEADS L inner join leads_contactinfo lc on l.fk_conid = lc.con_id" +
                        " WHERE l.FK_CONID = lc.CON_ID AND lc.FK_AGENTID = ? AND CON_INITDATE > to_date('2007/07/13', 'yyyy/mm/dd') AND CON_INITDATE < to_date('2007/08/14', 'yyyy/mm/dd')";

any suggestions would be greatly appreciated

mimsc
Junior Poster in Training
70 posts since Aug 2007
Reputation Points: 10
Solved Threads: 0
 

instead of hardcoding the dates use sysdate and sysdate-30 for the desired output.

debasisdas
Posting Genius
6,872 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434
 

thanx...let me try that

mimsc
Junior Poster in Training
70 posts since Aug 2007
Reputation Points: 10
Solved Threads: 0
 

ok...I tried that...im not too savvy with sql....should it look like this?:

String sqlStmt = "SELECT distinct count (lc.con_id) as TotalLeads FROM LEADS L inner join leads_contactinfo lc on l.fk_conid = lc.con_id" +
" WHERE l.FK_CONID = lc.CON_ID AND lc.FK_AGENTID = ? AND CON_INITDATE > to_date('sysdate-30', 'yyyy/mm/dd') AND CON_INITDATE < to_date('sysdate', 'yyyy/mm/dd')";

mimsc
Junior Poster in Training
70 posts since Aug 2007
Reputation Points: 10
Solved Threads: 0
 

im getting this error now java.sql.SQLException: ORA-01841: (full) year must be between -4713 and +9999, and not be

mimsc
Junior Poster in Training
70 posts since Aug 2007
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You