Solved

Select from 2 tables?  SQL 2005

Posted on 2009-05-17
4
174 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

932 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

12 Experts available now in Live!

Get 1:1 Help Now