Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Select records, upon last "inserted" ones

Author  Topic 

Leila
Starting Member

5 Posts

Posted - 2008-06-18 : 08:11:37
Hello,

I have a table with 2 columns, let's say: "No. Piece" and "Price".

I need to write a select statment that allows me to retrieve the last added records, is it possible?

Example:
At time t1, we have:
Piece 1, 300 Euros
Piece 2, 400 Euros
Piece 3, 250 Euros

At time t2 = t1 + 5mns, we have:
Piece 1, 300 Euros
Piece 2, 400 Euros
Piece 3, 250 Euros
Piece 4, 120 Euros
Piece 5, 390 Euros

The select statement should be able to give the following result:
Piece 4, 120 Euros
Piece 5, 390 Euros

Thank you in advance for your help and your time.

Leïla

elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2008-06-18 : 08:17:12
do you not have a column that contains the time it was added?

Em
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-18 : 09:56:32
Do you need to retrive the newly created records in every 5 mins?
Go to Top of Page

Leila
Starting Member

5 Posts

Posted - 2008-06-18 : 11:37:44
No, I don't have a column that contains the time it was added.

Actually, no, I don't need it to be retrived every 5 mns.

What I want is something like this:

Select Records that have been added the last t time.
or
Select Records that have been added in the last insert statment.

Is there anything able to retrieve records depending on such criteria?

Thanks,
Leïla
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-18 : 11:48:57
quote:
Originally posted by Leila

No, I don't have a column that contains the time it was added.

Actually, no, I don't need it to be retrived every 5 mns.

What I want is something like this:

Select Records that have been added the last t time.
or
Select Records that have been added in the last insert statment.

Is there anything able to retrieve records depending on such criteria?

Thanks,
Leïla


You mean just after the insert?
Go to Top of Page
   

- Advertisement -