1

I have a table which looks something like:

id batch_id start_ts stop_ts

I want to select those ids which started yesterday (can be easily done by giving start_ts > .. AND start_ts < ..) and have another id in the table with the same batch_id as the batch_id of this id and that id ended yesterday.

What would be a good way to frame this MySQL query?

1 Answer 1

2

What about ...

select <field list>  
from table t1
join table t2 on t1.id = t2.batch_id
where start_ts between <date 1> and <date 2>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.