Solved

sql combine 2 date fields into 1

Posted on 2013-01-06
1
278 Views
Last Modified: 2013-01-06
I have a table like this:
ID    date1                                    date2
1      2012-08-23 00:00:00.000     NULL
2      NULL                                     2012-07-04 00:00:00.000
3      2012-08-13 00:00:00.000      NULL



need a query to produce this output?
ID    date
1      2012-08-23 00:00:00.000    
2      2012-07-04 00:00:00.000
3      2012-08-13 00:00:00.000
0
Comment
Question by:JCTDD
1 Comment
 
LVL 17

Accepted Solution

by:
Kent Dyer earned 500 total points
ID: 38749600
use CASE

CASE WHEN date1 IS NULL THEN date2, ELSE date1 END As Date_selected

HTH,

Kent
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Introduction This article will provide a solution for an error that might occur installing a new SQL 2005 64-bit cluster. This article will assume that you are fully prepared to complete the installation and describes the error as it occurred durin…
So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

757 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

23 Experts available now in Live!

Get 1:1 Help Now