I have a concept question on this code:[code]SELECT cust_name,cust_state, (SELECT Count(*) FROM orders WHERE order.cust_id=customers.cust_id) as ordersFROM customersORDER BY cust_name;[/code]I understand how the Count function works with it counting the rows that are matching with regards to customers.cust_id with orders.customers_id. What concern me if what happens if there are many cust_names that are the same. How does SQL serve know to match up which cust_name with the correct cust_id in order to have the count function match the correct count with the customer_id?
↧