azzazzello
Technical User
I have a query which uses 2 tables in the following way.
SELECT records.phone as number, count(records.phone) as calls, customers.cust_name FROM records, customers WHERE ... AND records.phone = customers.phone GROUP by number;
basically, the records table contains the call records (including number) whereas customers table contains customer information, including customer name, and customer phone #. There are phone records that have phone numbers NOT listed in customers database. In the above query, these records will be IGNORED, as records.phone = customers.phone will fail for these records. What I need is a query that will, if possible, pull out cust_name for those numbers that an entry for them in customers database, but not ignore those that do not. Assigning NULL to cust_name field for these records will do just fine, as long as they are not ignored
SELECT records.phone as number, count(records.phone) as calls, customers.cust_name FROM records, customers WHERE ... AND records.phone = customers.phone GROUP by number;
basically, the records table contains the call records (including number) whereas customers table contains customer information, including customer name, and customer phone #. There are phone records that have phone numbers NOT listed in customers database. In the above query, these records will be IGNORED, as records.phone = customers.phone will fail for these records. What I need is a query that will, if possible, pull out cust_name for those numbers that an entry for them in customers database, but not ignore those that do not. Assigning NULL to cust_name field for these records will do just fine, as long as they are not ignored