Solved

sql, merge two tables (nothing in common)

Posted on 2013-10-23
2
389 Views
Last Modified: 2013-10-24
hello,

we have two different tables, with fields: date, name event, ....

one table = events
one table = seminars


how can we, combine those, in a query to obtain a list, ordered by date


exemple:

table event, contains:

idevent 1 date 1/01/2013 name: test event
idevent 2 date 2/02/2013 name: test event 2

table seminar, contains:

idseminar 1 date 15/01/2013 name= seminar 1


the result in my webpage should be:


idevent 1 date 1/01/2013 name: test event
idseminar 1 date 15/01/2013 name= seminar 1
idevent 2 date 2/02/2013 name: test event 2



how can we do this, someone any ideas? thx in advance

kristof
0
Comment
Question by:fedkris
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 33

Expert Comment

by:knightEknight
ID: 39594040
Classic homework assignment.  ;)
0
 
LVL 27

Accepted Solution

by:
Zberteoc earned 500 total points
ID: 39594652
Basically you want a union of the 2 events interlaced(sorted) by date:
select 
	idevent as EventId,
	date as EventDate,
	name as EventName
from
	events
union all
select 
	idseminar as EventId,
	date as EventDate,
	name as EventName
from
	seminar
order by
	EventDate,
	EventName

Open in new window

0

Featured Post

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question