Using Subdomains

If i have service1.onrender.com and have sub.service1.onrender.com it wont work cuz i need custom domains
so i use cname
mydomain.com cname: service1.onrender.com
to make the subdomain work should the cname for sub.mydomain.com be:
sub.mydomain.com cname: sub.service1.onrender.com
or
sub.mydomain.com cname: service1.onrender.com?
thanks

If the subdomain points to the same service and you have (sub)domain based routing in code, the subdomain needs to point to the same target CNAME as its parent.