Solved

sql combine 2 date fields into 1

Posted on 2013-01-06
1
281 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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

Suggested Solutions

Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
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…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

920 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

17 Experts available now in Live!

Get 1:1 Help Now