Advertisement

05.05.2008 at 12:19PM PDT, ID: 23377411
[x]
Attachment Details

Create a SELECT and UPDATE statement

Asked by MojoRisin2 in SQL Query Syntax, MS SQL Server, SQL Server 2005

Tags: ,

Hi,

I have a script which is intented to load an image from an Images table in a database. In the table there is a datetime column 'LastImpression' which holds the date and time of the last time this image was displayed.

I would like to create an SQL statement which will:
-  Return a single record with the 'oldest' LastImpression Date
-  Update the same record that was just loaded with a new datetime value in the LastImpression column

and I would like to have it all in one statement. Is it possible?

Any help would be greatly appreciated.Start Free Trial
[+][-]05.05.2008 at 12:23PM PDT, ID: 21502321

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.05.2008 at 12:34PM PDT, ID: 21502397

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.05.2008 at 12:35PM PDT, ID: 21502403

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.05.2008 at 12:36PM PDT, ID: 21502406

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.05.2008 at 12:39PM PDT, ID: 21502424

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.05.2008 at 12:42PM PDT, ID: 21502439

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: SQL Query Syntax, MS SQL Server, SQL Server 2005
Tags: MS SQL, 2000/2005
Sign Up Now!
Solution Provided By: chapmandew
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628