All pastes #32688 Raw Edit

Stuff

public sql v1 · immutable
#32688 ·published 2005-12-06 18:42 UTC
rendered paste body
SELECT dbo.hermes_base_users.first_name, dbo.hermes_base_users.last_name, dbo.hermes_base_users.uid, COUNT( DISTINCT dbo.hermes_mod_disp_call_log_calls.call_id ) AS "num_calls" FROM dbo.hermes_base_users, dbo.hermes_mod_disp_call_log_calls INNER JOIN dbo.hermes_mod_disp_call_log_calls ON dbo.hermes_base_users.uid = dbo.hermes_mod_disp_call_log_calls.uid WHERE (dbo.hermes_base_users.department='dispatch') ORDER BY num_calls, last_name, first_name--error below--Warning: mssql_query() [function.mssql-query]: message: Tables or functions 'dbo.hermes_mod_disp_call_log_calls' and 'dbo.hermes_mod_disp_call_log_calls' have the same exposed names. Use correlation names to distinguish them. (severity 15) in D:\Inetpub\wwwroot\dispatch2\modules\call_stats\mod_base.php on line 496Try this:SELECT a.first_name, a.last_name, a.uid, count( distinct b.call_id ) as "num_calls" from dbo.hermes_base_users a, dbo.hermes_mod_disp_call_log_calls b where a.uid=b.uid and a.department='dispatch' ORDER BY num_calls, last_name, first_name;