no keys...
i have a table where there is no primary key
i have 5 rows of data
day1 time1
day1 time1
day1 time2
day1 time2
day1 time2
time2 is newer than time1, how should i delete the four oldest record in the table. this means that the only row that will be left on my table is:
day1 time2
Each row automatically has an oid assigned to it, which can act as a key. It's
sort of "hidden", but all you have to do is "select oid,* from mytable" to
see it. Then you can delete based on that oid.
Regards,
Jeff
Show quoted text
On Tuesday 16 April 2002 12:31 pm, Dorward Villaruz wrote:
i have a table where there is no primary key
i have 5 rows of data
day1 time1
day1 time1
day1 time2
day1 time2
day1 time2time2 is newer than time1, how should i delete the four oldest record in
the table. this means that the only row that will be left on my table is:day1 time2
On Tue, 16 Jul 2002, Jeff Davis wrote:
Each row automatically has an oid assigned to it, which can act as a key. It's
sort of "hidden", but all you have to do is "select oid,* from mytable" to
see it. Then you can delete based on that oid.Regards,
JeffOn Tuesday 16 April 2002 12:31 pm, Dorward Villaruz wrote:
i have a table where there is no primary key
i have 5 rows of data
day1 time1
day1 time1
day1 time2
day1 time2
day1 time2time2 is newer than time1, how should i delete the four oldest record in
the table. this means that the only row that will be left on my table is:day1 time2
You can do something like this in sql:
delete from test where oid !=(select max(oid) from test group by time
order by time desc limit 1);