Solved

sql combine 2 date fields into 1

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
In this article I will describe the Copy Database Wizard 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.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

839 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