SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Join Two Select
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

engcanada
Starting Member

31 Posts

Posted - 06/01/2012 :  11:32:09  Show Profile  Reply with Quote
Can I use LEFT OUTER JOINfor the follwoing 2 statements? I tried it with no success. If Not, can anyone suggest an alternative.

select * from table1
select count(idreply) as total from table2

they have idjob in common.

Regards

visakh16
Very Important crosS Applying yaK Herder

India
47189 Posts

Posted - 06/01/2012 :  11:33:50  Show Profile  Reply with Quote

select t1.*,t2.total 
from table1 t1
left join (select idjob,count(idreply) as total 
           from table2
           group by idjob)t2
on t2.idjob = t1.idjob


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000