When you are installing SharePoint and SQL Server on the same machine, than you don't have to bother with this kind of problems, but if you want to install SharePoint on one server and SQL Server (which will hold SharePoint's databases) on the other server, than you need to join these two servers to the same domain for them to work together.
Procedure for doing this is very simple. This is what you need to do on each server:
1. Open Windows Explorer and go to path:
c:\Windows\System32\driver\etc
and open hosts.txt file in Notepad.
2. At the end of that file add your domain's IP address and name. For example:
192.168.1.10 mydomain.com
NOTE: You need to be able to ping this IP address from each of your servers.
3. On the each server go to:
Start - Control Panel - Network Connections - right mouse click on your Network Adpter and select "Properties" - select "Internet Protocol Version 4 (TCP/IPv4)" and click on button "Properties" - on the next screen select option "Use the following DNS server addresses" and write your domain server's IP address and save settings.
4. Go to:
My Computer - Properties - Advanced - Computer name and click on button "Change".
Now, instead of "WORKGROUP", write your domain's name, which you wrote in the hosts.txt file in step 2 (for example: mydomain.com).
If you did this procedure on each server, now they both should be in the same domain.