Solved

Select from 2 tables?  SQL 2005

Posted on 2009-05-17
4
168 Views
Last Modified: 2012-05-07
I need to perform this query.

Select firstname, email from dbo.providers where (Active = '1')  AND   (BIO from dbo.BIOS = '' where dbo.providers ID = dbo.bios ID)  

The column ID in dbo.providers is an identity column and also is identical in dbo.BIOS.  

I basically want to select the firstname and email from the providers table where their bio is blank in the bios table, and where Active = '1' in the providers table.

I hope this made sense.  


SQL 2005
0
Comment
Question by:arthurh88
  • 2
4 Comments
 
LVL 5

Expert Comment

by:Aanvik
ID: 24407048
Try this.
Select firstname, email from dbo.providers A

       LEFT JOIN dbo.BIOS B on A. providers ID  

       where A.Active = '1'  AND B.BIOS = '' 

Open in new window

0
 
LVL 60

Expert Comment

by:chapmandew
ID: 24407075
aanvik, doing a left join won't help you at all in the query since you're setting criteria on the BIOS table in your where clause.

Select firstname, email from dbo.providers A
       INNER JOIN dbo.BIOS B on A. providers ID  
       where A.Active = '1'  AND ISNULL(B.BIOS, '') = ''
0
 
LVL 60

Accepted Solution

by:
chapmandew earned 500 total points
ID: 24407083
sorry, that was all messed up.

Select firstname, email from dbo.providers A
       INNER JOIN dbo.BIOS B on A.ID= B.ID
       where A.Active = '1'  AND ISNULL(B.BIOS, '') = ''
0
 

Author Closing Comment

by:arthurh88
ID: 31582403
thank you that worked!
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how the fundamental information of how to create a table.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now