Here is my query:
SELECT count(*)
FROM table_testcase_execution
WHERE campaign_session_id = any(SELECT campaign_session_id
FROM table_campaign_session
WHERE campaign_session_name = 'sitename')
AND timestamp BETWEEN "1288929643485" AND "1289010305536"
This works just fine, the problem is that I have to use a LIKE on these because they contain 3 extra digits (so this is a timestamp plus 3 digits).
Therefore I am using a strtotime in php and trying to match these in the database, but they contain the extra 3 digits. Is there a way I can redo this sql or add a LIKE clause for each of these timestamps?
"1288929643485" AND "1289010305536"
Something like
SELECT count(*)
FROM table_testcase_execution
WHERE campaign_session_id = any(SELECT campaign_session_id
FROM table_campaign_session
WHERE campaign_session_name = 'sitename')
AND timestamp between LIKE "1288929643%" AND "1289010305%"
Assuming that the 3 extra digits can range from 000 to 999 then you could do something like this:
This along with an index in
timestampcolumn should give you good performance.