Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Select from 2 tables?  SQL 2005

Posted on 2009-05-17
4
Medium Priority
?
198 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

670 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