Re: Query Question

Nate wrote:

I am using a table, called 'dashboard', to track employee evaluations.

There are many columns in the table, some of which are populated with
one of four responses:
"Meets Expectations", "Below Expectations", "Not Observed", "Policy

I would like to create a query that will search for any employee that
has two "Below Expectations" in the SAME column in a span of 30 days.

I was thinking of using CONTAINS, but that would require me specifying
EVERY one of the evaluation critera (live_1, live_2.. all the way to
live_8.. then review_1, review_2... review_11)

How would you do it with CONTAINS?

If you change 'live_1', etc. from columns to values within a single
column, then you can do something like this:

select distinct d.employee
from dashboard d
join dashboard d2
on d.employee = d2.employee
and d.criterion = d2.criterion
and d.cr_date < d2.cr_date
where d.rating = 'Below Expectations'
and d2.rating = 'Below Expectations'
and d2.cr_date <= -- 30 days past d.cr_date

Otherwise, I guess you would need to do something like this:

select distinct employee from (
-- similar logic for live_1
-- similar logic for live 2
-- etc.
) as lumberghs