Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Join Two Select

Author  Topic 

engcanada
Starting Member

39 Posts

Posted - 2012-06-01 : 11:32:09
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

52326 Posts

Posted - 2012-06-01 : 11:33:50
[code]
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
[/code]

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

Go to Top of Page
   

- Advertisement -