Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Iterate results update records

Status
Not open for further replies.

Challanged

Programmer
Jan 13, 2017
1
GB
Hi Guys can you help with coming up with a query.
I update this table daily by crawling a website each day with vehicle details .
What i need is if a registraion is missing for a day I want to update VehicleSOLDDate with the latest datetime for that missing registraion ?

using SQL server 2012

registraion | Datetime |VehicleSOLDDate
abc def |01/01/2017 00:00 |
aaa bbb |01/01/2017 00:00|
abc def |02/01/2017 00:00|
aaa bbb |02/01/2017 00:00|
abc def |03/01/2017 00:00 | 03/01/2017
aaa bbb |03/01/2017 00:00|
aaa bbb |04/01/2017 00:00 |
 
You need to keep a copy of the previous day's query. Then use a MINUS or NOT IN query to find all records that are in yesterday's data, but not in today's.

==================================
advanced cognitive capabilities and other marketing buzzwords explained with sarcastic simplicity


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top