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

sql, merge two tables (nothing in common)

Posted on 2013-10-23
Last Modified: 2013-10-24

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


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

Question by:fedkris
LVL 33

Expert Comment

ID: 39594040
Classic homework assignment.  ;)
LVL 26

Accepted Solution

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

Open in new window


Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Encrypting SQL Server 2014 or SQL Server 2016 4 30
sql server query 12 26
MS SQL + group by time 4 15
.NET Enums [Flags] & Bitwise Design Question 6 28
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
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 SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

828 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