Let me start with saying that if you have duplicate content on your site, search engines might penalize you for it. Content should not be both available through example.com and sub.example.com.
That said, if mydomain.com and sub.mydomain.com reside on the same server, the easiest way is to configure the subdomain to use the same www-root as the normal domain. You can use something along the lines of this in your main config file:
Listen 80
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /www/example1
ServerName example.com
DocumentRoot /www/
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /www/example2
ServerName sub.example.com
DocumentRoot /www/
</VirtualHost>
If the main domain is located on a different server than the sub domain is pointing to, you can proxy the requests. You would something along the lines of this in your main config file:
<VirtualHost *:80>
ProxyPreserveHost On
ProxyPass / http://example.com
ProxyPassReverse / http://example.com
ServerName sub.example.com
</VirtualHost>
See this resource for more examples on vhost configuration.