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.
    
        | 
                
                    | 
                            
                                | Author | Topic |  
                                    | tpayneStarting Member
 
 
                                        18 Posts | 
                                            
                                            |  Posted - 2009-08-18 : 16:21:34 
 |  
                                            | I have two tables Master and Detail joined by a key.  I need a query to return all the detail records that match the master key even if they are duplicates.I thought this would be easy like this.select count(*)form Detail DJoin Master M on E.key = M.keyThis doesn't seem to return the duplicate Detail records though.I thought about using left join but that return all detail regardless of a match in Master.  Thanks in advance. |  |  
                                    | SwePesoPatron Saint of Lost Yaks
 
 
                                    30421 Posts | 
                                        
                                          |  Posted - 2009-08-18 : 16:29:33 
 |  
                                          | SELECT	m.key,	count(d.*)from	Master as Mleft join Detail as D on d.key = M.keygroup by m.key N 56°04'39.26"E 12°55'05.63"
 |  
                                          |  |  |  
                                |  |  |  |