Skip to Content
Former Member
Aug 17, 2007 at 02:49 PM

Need a query to select the records in the table.



This is one record in my database.

<u><b>Field Name - Value</b></u>

Docid - 026464295

Logging_Indexing - 6/1/2006 12:00:00 AM

LogQ1 - 6/2/2006 12:00:00 AM

LogQ1Res - 6/3/2006 4:35:00 AM

LogQ2 - <b>Null</b>

LogQ2Res - <b>Null</b>

Logging_Indexing_End - 6/5/2006 4:35:00 PM

Here I dont have Log2 and LogQ2Res bcoz i have not raised 2nd query and completed the Logging_Indexing stage.

If I have all fields, i will write my query like this.

My Query is :


FROM dsr

WHERE #6/3/2006 4:35:00 AM# between Logging_Indexing and LogQ1 or #6/3/2006 4:35:00 AM# between LogQ1Res and LogQ2 or #6/3/2006 4:35:00 AM# between LogQ2Res and Logging_Indexing_End;

If I run this, i have get that record. but it is not giving any results.

If I dont have some values, like

if LogQ2 & LogQ2Res is NULL, then it has to check between LogQ1Res and Logging_Indexing_End.

If LogQ1 & LogQ1Res is also NULL, then it has to check between Logging_Indexing and Logging_Indexing_End.

I will be having mixture of all the types of recods in the database.

Logging_Indexing & Logging_Indexing_End are compulsory fields.

Please help me out in writing the query on these conditions.

Thanks in advance,