Solved

sql, merge two tables (nothing in common)

Posted on 2013-10-23
2
372 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
2 Comments
 
LVL 33

Expert Comment

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

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now