I have a dataset of field samples whose attributes include: a sample name, a timestamp of analysis (unique key), analysis result, date sampled, and a Boolean attribute 'rerun' that describes if the record is the result of a second analysis of the same sample. This means that there can be multiple records with the same sample name and sample date, but in that case, the second record (rerun = TRUE) is the preferred result for the selection.
name timestamp analysisResult rerun dateSampled
I have attempted to use the CASE function, but I think I am missing something simple. I'm trying to put it as an element of the WHERE clause, but that is not working as is.
For example, I'm trying something like:
SELECT name,analysisResult
FROM sciencyTable
WHERE date = '12/02/11',
AND (some working CASE function)
ORDER BY time;
Any hints would be appreciated. Thank you.