afsal neelambra
how can joint three or more tables
Posted by afsal neelambra in Database | SQL Server on Jul 12, 2011
0
Do you know the answer for this question? Post it below.
Guest

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

Posted by RMS on Jul 23, 2011

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 '

Posted by urvi Mehta on Jul 18, 2011
Sponsored by
Nevron Gauge for SharePoint
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
Sponsored by
Nevron Gauge for SharePoint
Become a Sponsor
PRIVACY POLICY | TERMS & CONDITIONS | SITEMAP | CONTACT US | REPORT ABUSE © 2011 C# Corner. All contents are copyright of their authors.