Question : SQL Select statement

I have a stored procedure that pulls claims for a policy year.  Due to the nature of the business, each claim can have many evaluation dates to track the payments received and expenses paid as of certain dates.  Each time a claim incurs an expense, it is added into the financial history table and the eval_date is recorded.

For example - as of 11/30/2009 paid expenses may be $1,000.  So if I run as of eval_date = 20091130 I will get $1,000.  I could then run as of year end, eval_date = 20091231 and get $1,500.    I pass eval_date to the procedure as a parameter from a VB.net app.  

But there are some claims that haven't had any incurred payments or expenses and the eval_date is null.  I don't want to see these claims in my result set.  

It's structured like this:

SELECT fields
FROM (A bunch of joined tables),
A bunch of Subqueries LEFT JOINED that are pulling the payments and expenses
then my where clause

In the subqueries that are left joined I pull out paid amounts and reference the eval_date there.  The table where the eval_date resides in not included in the joins in the 'main' FROM clause.

I'm a bit confused (I hope you are not as you read this) where I would put this constraint on the procedure to exclude claims with a null eval_date.  

Any thoughts?

Answer : SQL Select statement

try this
1:
2:
3:
4:
5:
WHERE ISNULL(FINANCIAL_HIST.EVAL_DATE, '1900.01.01') <=  @userdate
AND POLICY.INSURER_EID = 12345 
AND CLAIM.LINE_OF_BUS_CODE = 123
AND POLICY.POLICY_NUMBER LIKE '%-08'
AND CLAIM.CLAIM_TYPE_CODE <> '5058'
Random Solutions  
 
programming4us programming4us