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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 One view, two tables

Author  Topic 

richardlaw
Yak Posting Veteran

68 Posts

Posted - 2010-10-02 : 08:24:28
Hi

I have to tables, one for competitions dates, and one for other events. Both have similar data, but not all the same.

What I'd like to do is create a view that merges the two, so that I have one column for date, and one column for event title.

Does this make sense? Currently, I can create a view with 2 sets of titles and 2 dates - one value for each depending on which table it originally came from, but I need only one title, and one date.

Any help would be much appreciated.

Thanks
Richard

vaibhavktiwari83
Aged Yak Warrior

843 Posts

Posted - 2010-10-02 : 08:41:42
[code]
CREATE VIEW vw_Events
AS

SELECT <Title Column>, Date FROM <Competition Table>
UNION
SELECT <Title Column>, Date FROM <Other Event Table>

[/code]

Do you need any thing else ?

Vaibhav T

To walk FAST walk ALONE
To walk FAR walk TOGETHER
Go to Top of Page

richardlaw
Yak Posting Veteran

68 Posts

Posted - 2010-10-02 : 10:16:55
quote:



SELECT <Title Column>, Date FROM <Competition Table>
UNION
SELECT <Title Column>, Date FROM <Other Event Table>






This looks to work perfectly - many thanks
Richard
Go to Top of Page

vaibhavktiwari83
Aged Yak Warrior

843 Posts

Posted - 2010-10-02 : 10:39:32
Welcome

Vaibhav T

To walk FAST walk ALONE
To walk FAR walk TOGETHER
Go to Top of Page
   

- Advertisement -