Dear Sir,
I want to display 6 tables value in a single gridview how to do this.
EmpCode, EmpName come from tbl_Employees and remaining value come from other tables.
I have shared my table structure as well as code.
CREATE TABLE [dbo].[civil_comp_box] (
[COMP_ID] INT NULL,
[EmpCode] NVARCHAR (10) NULL,
[COMP_MESSAGE] NVARCHAR (MAX) NULL,
[STATUS_ID] NVARCHAR (10) NULL,
[COMP_LODGE_DATE] DATETIME NOT NULL,
[CLOSING_DATE] NVARCHAR (50) NULL,
[REMARKS] NVARCHAR (500) NULL,
[S_GUID] UNIQUEIDENTIFIER NULL,
[remote_ip] NVARCHAR (50) NULL,
[who] NVARCHAR (50) NULL,
[user_feedback] NVARCHAR (255) NULL,
[type] NVARCHAR (255) NULL,
[attend_date] NVARCHAR (50) NULL
);
CREATE TABLE [dbo].[civil_comp_box_plnt] (
[COMP_ID] INT NULL,
[EmpCode] NVARCHAR (10) NULL,
[COMP_MESSAGE] NVARCHAR (MAX) NULL,
[STATUS_ID] NVARCHAR (10) NULL,
[COMP_LODGE_DATE] DATETIME NOT NULL,
[CLOSING_DATE] DATETIME NULL,
[REMARKS] NVARCHAR (100) NULL,
[S_GUID] UNIQUEIDENTIFIER NULL,
[remote_ip] NVARCHAR (50) NULL,
[who] NVARCHAR (50) NULL,
[COTYPE] NVARCHAR (255) NULL,
[MAT_CONSUM] NVARCHAR (255) NULL,
[user_feedback] NVARCHAR (255) NULL,
[type] NVARCHAR (255) NULL,
[attend_date] DATETIME NULL
);
CREATE TABLE [dbo].[elec_comp_box] (
[COMP_ID] INT NULL,
[EmpCode] NVARCHAR (10) NULL,
[COMP_MESSAGE] VARCHAR (MAX) NULL,
[STATUS_ID] NVARCHAR (10) NULL,
[COMP_LODGE_DATE] DATETIME NOT NULL,
[CLOSING_DATE] DATETIME NULL,
[REMARKS] NVARCHAR (500) NULL,
[S_GUID] UNIQUEIDENTIFIER NULL,
[remote_ip] NVARCHAR (50) NULL,
[who] NVARCHAR (50) NULL,
[user_feedback] NVARCHAR (255) NULL,
[type] NVARCHAR (255) NULL,
[ATTEND_DATE] DATETIME NULL
);
CREATE TABLE [dbo].[elec_comp_box_plant] (
[COMP_ID] INT NULL,
[EmpCode] NVARCHAR (10) NULL,
[COMP_MESSAGE] NVARCHAR (MAX) NULL,
[STATUS_ID] NVARCHAR (10) NULL,
[COMP_LODGE_DATE] DATETIME NOT NULL,
[CLOSING_DATE] DATETIME NULL,
[REMARKS] NVARCHAR (500) NULL,
[S_GUID] UNIQUEIDENTIFIER NULL,
[remote_ip] NVARCHAR (50) NULL,
[who] NVARCHAR (50) NULL,
[user_feedback] NVARCHAR (255) NULL,
[type] NVARCHAR (255) NULL,
[ATTEND_DATE] DATETIME NULL
);
CREATE TABLE [dbo].[IT_comp_box] (
[COMP_ID] INT NULL,
[EmpCode] NVARCHAR (10) NULL,
[COMP_MESSAGE] NVARCHAR (MAX) NULL,
[STATUS_ID] NVARCHAR (10) NULL,
[COMP_LODGE_DATE] DATETIME NOT NULL,
[CLOSING_DATE] DATETIME NULL,
[REMARKS] VARCHAR (255) NULL,
[S_GUID] UNIQUEIDENTIFIER NULL,
[remote_ip] NVARCHAR (50) NULL,
[who] NVARCHAR (50) NULL,
[user_feedback] NVARCHAR (255) NULL,
[type] NVARCHAR (255) NULL,
[ATTEND_DATE] DATETIME NULL,
[ATTEND_BY] VARCHAR (255) NULL
);
CREATE TABLE [dbo].[tbl_Employees] (
[EID] INT IDENTITY (1, 1) NOT NULL,
[EmpCode] VARCHAR (10) NULL,
[EmpName] NVARCHAR (50) NULL,
[DeptID] INT NULL,
[DesignationID] INT NULL,
[LevelID] INT NULL,
[SeniorityOrder] INT NULL,
[EmailID] NVARCHAR (50) NULL,
[Mobile] NVARCHAR (20) NULL,
[AlternateMobileNumber] NVARCHAR (20) NULL,
[IntercomOffice] NVARCHAR (20) NULL,
[IntercomResidence] NVARCHAR (20) NULL,
[Location] NVARCHAR (200) NULL,
[Gender] VARCHAR (10) NULL,
[DOB] DATE NULL,
[DOR] DATE NULL,
[BloodGroupID] INT NULL,
[Cadre] VARCHAR (20) NULL,
[PANNo] VARCHAR (50) NULL,
[PhotoPath] NVARCHAR (200) NULL,
[UserName] VARCHAR (10) NULL,
[Password] NVARCHAR (200) NULL,
[IsDepartmentAdmin] BIT NULL,
[AdminDeptID] INT NULL,
[IsActive] BIT NULL,
[IsDeleted] BIT NULL,
[RegisteredOn] DATETIME NULL,
[ModifiedOn] DATETIME NULL,
[IsHOD] BIT NULL,
[EmpNameHindi] NVARCHAR (100) NULL,
[DOJ_atProject] DATE NULL,
[DOP_Last] DATE NULL,
[QuarterType] NVARCHAR (50) NULL,
[QuarterNo] NVARCHAR (50) NULL,
[CompanyId] NCHAR (10) NULL
);
I am trying to mention query but same is not working.
SELECT f.EmpCode,f.EmpName,a.COMP_ID,a.COMP_MESSAGE,b.STATUS_ID,c.COMP_LODGE_DATE,c.CLOSING_DATE,c.REMARKS
FROM IT_comp_box a,civil_comp_box b,civil_comp_box_plnt c,elec_comp_box d,elec_comp_box_plant e,tbl_Employees f
where a.EmpCode=b.EmpCode and a.EmpCode=c.EmpCode and a.EmpCode=d.EmpCode and a.EmpCode=e.EmpCode and f.EmpCode='007221'