I have below query to check customer subscription. This is not quite right way to do in query but I do not know how to optimize or correct it. Here it is.
SELECT sub_id FROM subscription
WHERE start_date = CURDATE()
AND end_date > CURDATE()
AND sub_id NOT IN (SELECT DISTINCT sub_id FROM subscription
WHERE start_date < CURDATE());
The reason of sub query is to sieve out sub_id previously did at least a subscription.