We help IT Professionals succeed at work.
Get Started

basic query question - one or multiple queries?

Last Modified: 2012-05-11
This is probably basic, but is stumping me. I am trying to program a dashboard, showing a variety of data points across our database.

For example, I have one table that shows quotes for a job (a job can have multiple quotes); I want to show, for a given job, whether there is an active quote (status field = 1), whether there is a quote that needs internal approval (another field), and whether there is a quote that needs client approval (yet another field).

Can this be done efficiently in a single query? I tried this in a single query using several sum(iif(XXX,1,0)) statements, but I was told this was 'deprecated' (i.e. not the right way to do it). Is there another way? Or do I need to write a whole bunch of very simple queries, and then for the dashboard tie them all together?

The problem, as you can see, if that I am going to a variety of child tables and each query has a slightly different scope/criteria...

Your thoughts are greatly appreciated!
Watch Question
Chief Technology Officer
Most Valuable Expert 2011
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