tags:

views:

36

answers:

4
+1  Q: 

sql clarification

Can anyone please clarify what this query will return ?

SELECT TestCase FROM MyTable  WHERE Verdict = 'PASS' AND 
StartTime > DATE_SUB(NOW(), INTERVAL 2 MONTH)
A: 

All passing test cases that were run (started, to be precise) in the last two months.

Marcelo Cantos
A: 

DATE_SUB subtracts a time value from a date, in this case it will subtract 2 months from today's date.

This query will therefore return the field TestCase where Verdict = 'PASS' and the StartTime is within the last 2 months ( StartTime > two months ago).

+2  A: 

DATE_SUB(NOW(), INTERVAL 2 MONTH) will return the date that was 2 months before from present date.

So your query will return all the test cases that have Verdict as 'PASS' and whose startTime was within the last 2 months.

codaddict
A: 

This Query will return all the "TestCase" which has the Verdict value is equal to 'PASS' for the past 2 months...that is (current month-2)

VAC-Prabhu