Gregg D Bolinger wrote:
The statement I have so far, and it works, but I need to add to it but
I am afraid that just supplying all the AND's in the WHERE clause is
not very good design. I should probably be using some sort of join.
I am not sure what you are saying. WHERE is a JOIN! Same thing!
If it helps you I ALLWAYS write my sql 1st in a SQL admin type tool (every DB engine has one). To get the sytnax and make sure what I am getting.
If you worry about performance, ... then you can do a show plan. Likely unless you start into millions of records that you do not want to worry about it too much, DB engine will just stick it in RAM.
Else, I am not sure what your concern is/was.
.V
ps: if your issue has no one assigned or no status, that querry would not return those records... unless you switch to outher joins.
Here is the statement in my issue.xml file.
<statement id="getAllIssuesForEmployee" parameterClass="int"
resultMap="get-issue-result">
select * from t_issue, t_user, t_employee, t_issue_status WHERE creating_user_id = user_id AND t_issue.status_id = t_issue_status.status_id AND t_employee.employee_id = t_issue.employee_id AND t_issue.employee_id = #value#
</statement>

