We help IT Professionals succeed at work.
Get Started

SQL Query Across Multiple Tables - Help

162 Views
Last Modified: 2017-04-25
Hello Experts!

I am OK with queries when it involves one table but not so great with multiple table and filtering. I have the following issue i hope someone can help me with:

Tables

tblAccounts
tblServiceOrders
tblInvoices

Relevant Fields
tblAccounts.AccountName
tblAccounts.AccountNumber
tblAccounts.AccountStatus
tblAccounts.AccountType

tblInvoices.InvoiceDate

tblServiceOrders.DateReceived

All Linked by AccountNumber field in all tables.


This is a customer database with all accounts and all their respective service requests and invoices. Looking for a query to provide a list of accounts that meet the following:

AccountStatus=Active
AccountType=Customer

And has had a service order or invoice in the last three years.


Also would like query for the inverse of this; list of accounts that DON’T meet this filter.

Thank you!
Comment
Watch Question
CERTIFIED EXPERT
Top Expert 2010
Commented:
This problem has been solved!
Unlock 1 Answer and 5 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