We help IT Professionals succeed at work.
Get Started

SQL Syntax question #10

Last Modified: 2010-04-21
I have this query and I need to return 0 for the nested queries results for 'requests' and 'total amount'. I have used ISNULL but I still get back blank values. Can anyone help.

FROM AuditorTemp a
      LEFT JOIN (
            select users.id as UserID, users.first_name + ' ' + users.last_name as Name, count(*) as 'requests', ISNULL(sum(u.amount),0) as 'total amount'
            from takeoff_requests t, takeoff_request_accounts tra, accounts_master am, underpayments u, users
            where t.manager_action = 'complete'
            and t.id = tra.takeoff_request_id
            and tra.account_id = am.account_id
            and tra.account_id = u.account_id
            and u.user_id = users.id
            group by users.id, users.last_name, users.first_name
      ) b ON a.id = b.userid
Order by a.id
Watch Question
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE