afsal neelambra
how can joint three or more tables
By afsal neelambra in SQL Server on Jul 12 2011
  • Paul Salerno
    Jul, 2011 28

    Is this 3 tables?  that was the question. 

    select e1.empno,e2.empno,d1.deptno,e1.deptno

    from emp e1

    inner join emp_dummy e2 on e1.empno=e2.empno

    inner join DeptDetails d1 on d1.deptno=e1.deptno

    • 0
  • RMS
    Jul, 2011 23

    select e1.empno,e2.empno,d1.deptno,e1.deptno

    from emp e1

    inner join emp_dummy e2 on e1.empno=e2.empno

    inner join DeptDetails d1 on d1.deptno=e1.deptno

    • 0
  • urvi Mehta
    Jul, 2011 18

    SELECT *   FROM  TableName
       LEFT OUTER JOIN  NameoftheTableforJoin ON ForeignKeyJoinTableName = PrimaryKeyJoinTableName
     LEFT OUTER JOIN NameoftheTableforJoin ONForeignKeyJoinTableName = ForeignKeyJoinTableName               
     
    Example

    SELECT Pk_PropertyMaster,0 as Fk_ProjectType_Enum,Fk_OfferType_Enum,AreaName,PropertyType,FirstName As BAFirstName,LastName As BALastName,PhoneNo As BAPhoneNo,PropertyId,             
       NoOfBedroom, NoOfBathroom,NoOfTotalRooms,NoOfStories,TotalArea, ConstructionArea, TotalPrice, PricePerUnit,PropertyMaster.Address1,PropertyMaster.Address2,             
       Fk_UserMaster_EntryBy, MainImage,'''' as BuilderName, '''' as ProjectTitle, '''' as PlanTitle, ''property'' as ListingType,PropertyTypeMaster.Fk_PropertyTypeMaster_Category as Fk_PropertyTypeMaster_Category,       
       PropertyTypeMaster.Fk_PropertyCategory_Enum as Fk_PropertyCategory_Enum, PropertyMaster.latitude, PropertyMaster.longitude, '''' as ProjectDetailsPage             
       FROM PropertyMaster                                          
       LEFT OUTER JOIN AreaMaster ON Fk_AreaMaster = Pk_AreaMaster                                         
     LEFT OUTER JOIN PropertyTypeMaster ON Fk_PropertyTypeMaster = Pk_PropertyTypeMaster                  
       LEFT OUTER JOIN UserMaster ON Fk_UserMaster_EntryBy = Pk_UserMaster '

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS