Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Use Date if Exists

$
0
0

I have tables A and B. Table A contains dates for all rows, but I need to use table B dates if they exist for matching rows in Table A.

I need to select all rows in Table A and replace the dates that exist in Table B for matching rows only. So, in the data below I would want to return 3 rows but the date for order 1234 needs to be from Table B (6/26/2013). Thanks in advance, skip.

Table A

OrderDate
12346/24/2013
123456/25/2013
122226/26/2013

Table B

OrderDate
12346/26/2013

OrderDate
12346/24/2013
123456/25/2013
12222

6/26/2013

 

 


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>