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 |  
                                    | ppatel112Starting Member
 
 
                                        35 Posts | 
                                            
                                            |  Posted - 2014-09-18 : 21:17:04 
 |  
                                            | Hi Peeps,i have created below view that pull out phone numbers with different types from phone and phonelink tables for persons.select  p.pers_firstname,p.pers_lastname, phm.phon_Number as Mobile, phh.phon_Number as Home,phb.phon_Number as Businessfrom    Person pLEFT JOIN PhoneLink plmon     p.Pers_PersonId = plm.PLink_RecordId AND plm.Plink_Type = 'Mobile' AND plm.PLink_EntityId = '13' AND plm.Plink_deleted IS NULLLEFT JOIN Phone phm  ON plm.PLink_PhoneId = phm.Phon_PhoneId AND phm.phon_deleted IS NULLLEFT JOIN PhoneLink plhon     p.Pers_PersonId = plh.PLink_RecordId AND plh.Plink_Type = 'Home' AND plh.PLink_EntityId = '13' AND plh.Plink_deleted IS NULLLEFT JOIN Phone phh  ON plh.PLink_PhoneId = phh.Phon_PhoneId AND phh.phon_deleted IS NULLLEFT JOIN PhoneLink plbon     p.Pers_PersonId = plb.PLink_RecordId AND plb.Plink_Type = 'Business' AND plb.PLink_EntityId = '13' AND plb.Plink_deleted IS NULLLEFT JOIN Phone phb  ON plb.PLink_PhoneId = phb.Phon_PhoneId AND phb.phon_deleted IS NULLwhat i want to do is to add a where clause to not return null rows in the results so i dont want any rows as below.firstname    lastname    home     mobile     businesstest          test        NULL     NULL       NULLalso, there there any way to make this view dynamic so that if any new phone types are added it will cater that requirement instead of adding new joins?please advise.regards,parth |  |  
                                    | ppatel112Starting Member
 
 
                                    35 Posts | 
                                        
                                          |  Posted - 2014-09-18 : 21:34:08 
 |  
                                          | i just placed a where clause at the end and it did the trickWHERE phm.phon_Number IS NOT NULL OR phh.phon_Number IS NOT NULL OR phb.phon_Number IS NOT NULLalso, there there any way to make this view dynamic so that if any new phone types are added it will cater that requirement instead of adding new joins? |  
                                          |  |  |  
                                |  |  |  |