﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Administering / SQL Server 2005  / Merge a 3 tables data in one view / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Thu, 23 May 2013 11:02:36 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Merge a 3 tables data in one view</title><link>http://www.sqlservercentral.com/Forums/Topic1233760-146-1.aspx</link><description>[quote][b]pallavi.unde (1/11/2012)[/b][hr]...can i make a view of above 3 tables as a one view..???? these three tables has totally different data...[/quote]Assuming you figure out a way to join those tables, not problem at all.Ask yourself... how do I related rows on one table to rows on the other two tables?If you have a positive answer to that question just code it on your view's predicate and be happy forever after.</description><pubDate>Thu, 12 Jan 2012 07:22:06 GMT</pubDate><dc:creator>PaulB-TheOneAndOnly</dc:creator></item><item><title>RE: Merge a 3 tables data in one view</title><link>http://www.sqlservercentral.com/Forums/Topic1233760-146-1.aspx</link><description>You haven't provided enough information for anyone to provide an accurate answer.  What do you want the view to provide?  A union of the results from the tables or a Join of the results of the tables?What are the relationships between the tables that would allow you to join them together?  The only foreign key you have defined is:[code="sql"]ALTER TABLE [dbo].[College_CutoffMaster] WITH NOCHECK ADD CONSTRAINT [FK_College_CutoffMaster_College_CutoffMaster] FOREIGN KEY([CutoffId])REFERENCES [dbo].[College_CutoffMaster] ([CutoffId])[/code]and I don't even know how that would work as you have column referencing itself so I don't even know how that would work since once you have cutOffID 1 in the database it can only reference itself since you can't insert another CutOffID 1 because it is also the Primary Key.Since I'm forced to guess I assume that you would JOIN college_cutoffmaster to college_Maharashtra_ArchitectureCutoffmaster on CutoffID, but I don't know that.  I'm not sure how you'd join to the third table.</description><pubDate>Wed, 11 Jan 2012 08:55:00 GMT</pubDate><dc:creator>  Jack Corbett</dc:creator></item><item><title>Merge a 3 tables data in one view</title><link>http://www.sqlservercentral.com/Forums/Topic1233760-146-1.aspx</link><description>I have 3 tables as below,USE [Dummy_New]GO/****** Object:  Table [dbo].[College_CutoffMaster]    Script Date: 01/11/2012 13:15:02 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE TABLE [dbo].[College_CutoffMaster](	[CutoffId] [numeric](18, 0) NOT NULL,	[Cutoff] [numeric](18, 0) NULL,	[CollegeId] [numeric](18, 0) NOT NULL,	[DegreeId] [numeric](18, 0) NOT NULL,	[StreamId] [numeric](18, 0) NOT NULL,	[EntranceId] [numeric](18, 0) NOT NULL,	[Gender] [nchar](10) NOT NULL,	[UniversityType] [nchar](2) NULL,	[Capround] [nchar](10) NULL, CONSTRAINT [PK_College_CutoffMaster] PRIMARY KEY CLUSTERED (	[CutoffId] ASC)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]) ON [PRIMARY]GOALTER TABLE [dbo].[College_CutoffMaster]  WITH NOCHECK ADD  CONSTRAINT [FK_College_CutoffMaster_College_CutoffMaster] FOREIGN KEY([CutoffId])REFERENCES [dbo].[College_CutoffMaster] ([CutoffId])GOALTER TABLE [dbo].[College_CutoffMaster] CHECK CONSTRAINT [FK_College_CutoffMaster_College_CutoffMaster]GOUSE [Dummy_New]GO/****** Object:  Table [dbo].[College_HMCTCutoffMaster]    Script Date: 01/11/2012 13:16:35 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOSET ANSI_PADDING ONGOCREATE TABLE [dbo].[College_HMCTCutoffMaster](	[HmctCutoffId] [int] NOT NULL,	[HmctCutoff] [numeric](18, 2) NOT NULL,	[CollegeCode] [varchar](50) NOT NULL,	[CollegeId] [numeric](18, 0) NOT NULL,	[DegreeId] [numeric](18, 0) NOT NULL,	[StreamId] [numeric](18, 0) NOT NULL,	[EntranceId] [numeric](18, 0) NOT NULL,	[CutoffStateName] [varchar](50) NOT NULL,	[Gender] [nchar](10) NOT NULL,	[UniversityType] [varchar](50) NOT NULL,	[Capround] [nchar](10) NOT NULL,	[CreatedOn] [datetime] NULL,	[CreatedBy] [numeric](18, 0) NULL,	[EditedOn] [datetime] NULL,	[EditedBy] [numeric](18, 0) NULL,	[Version] [int] NOT NULL, CONSTRAINT [PK_College_HMCTCutoffTransition] PRIMARY KEY CLUSTERED (	[HmctCutoffId] ASC)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]) ON [PRIMARY]GOSET ANSI_PADDING OFFGOUSE [Dummy_New]GO/****** Object:  Table [dbo].[College_Maharashtra_ArchitectureCutoffmaster]    Script Date: 01/11/2012 13:17:00 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE TABLE [dbo].[College_Maharashtra_ArchitectureCutoffmaster](	[CutoffId] [numeric](18, 0) NOT NULL,	[Cutoff] [numeric](18, 2) NULL,	[CollegeId] [numeric](18, 0) NOT NULL,	[DegreeId] [numeric](18, 0) NOT NULL,	[StreamId] [numeric](18, 0) NOT NULL,	[EntranceId] [numeric](18, 0) NOT NULL,	[Gender] [nchar](10) NULL,	[UniversityType] [nchar](10) NULL,	[Capround] [nchar](10) NULL,	[CollegeCode] [numeric](18, 0) NULL,	[Rank] [numeric](18, 0) NULL,	[CreatedOn] [datetime] NULL,	[CreatedBy] [numeric](18, 0) NULL,	[EditedOn] [datetime] NULL,	[EditedBy] [numeric](18, 0) NULL,	[Version] [int] NULL, CONSTRAINT [PK_College_Maharashtra_ArchitectureCutoffmaster] PRIMARY KEY CLUSTERED (	[CutoffId] ASC)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]) ON [PRIMARY]GOI have data in it.... here only i can make a view of individual table but can i make a view of above 3 tables as a one view..???? these three tables has totally different data...My colleague said it will be possible after using decode function.. but i think no.....please reply...</description><pubDate>Wed, 11 Jan 2012 00:51:03 GMT</pubDate><dc:creator>pallavi.unde</dc:creator></item></channel></rss>