*
The moose likes JDBC and the fly likes Sql statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Sql statement" Watch "Sql statement" New topic
Author

Sql statement

shumani edzani
Greenhorn

Joined: Oct 03, 2008
Posts: 9
Hi All..

I have been struggling with this code for 3 hours now,can you please help.this code is hard coded and i need to unhard code it,so here is the code please help.

select staticdata.descr as deptname,appraisal.state as appraisalPhase,appraisal.lastupdated,appraisal.scoreunitid
from appraisal
left JOIN hruser on hruser.userid = appraisal.appraisee
LEFT JOIN staticdata on staticdata.id = hruser.deptname
where appraisal.lastupdated > "1999/01/01"
AND appraisal.lastupdated < "2009/01/01"
and appraisal.state in ("SUBMITTED", "CREATED_INCOMPLETE", "UPDATED_UNCONFIRMED", "COMPLETE_UNCONFIRMED"
, "DEV_PLAN_SET")
AND staticdata.id in ("1179991863437762177185","123539977081431915490412353998213101873543512353999380021949703600")
group by hruser.deptname

Thank you.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39549
    
  27
What do you mean by "un-hardcode" it? What are you trying to do with this query?


Ping & DNS - updated with new look and Ping home screen widget
denis sorn
Ranch Hand

Joined: Apr 30, 2008
Posts: 33
I presume he wants to be able to change parameters dynamically...

If this is what you want Shumani you can do it with PreparedStatement.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sql statement
 
Similar Threads
Dual Program (Applet & Application) : Need to know how to improve in Applet ways only!
Multiple Actions issue in JSF
passing values from struts2 form to javascript
Can not Populate the form on combo box change
Hibernate LEFT JOIN FETCH WITH syntax