Castor
Sep 9th, 1999, 08:52 PM
All right. I've been playing with this all day so far and I haven't gotten anywhere. I'm hoping there's an SQL guru out there who can help me out.
This may sound really wierd, but this is what I need...
I am building a database to keep track of our server backup scheme and which tape was used for each backup. I thought it would be nice for the program to pick which tape should be used on any given day. It should choose the tape that was used least recently. So basically, what I have is this.
A table with TapeId and DateUsed
1 4
2 5
3 6
4 7
1 8
2 9
3 10
4 11
1 12
Now, in real life, the TapeId is not as simple as 1,2,3,4 (also pretend that the second column is a date, I just didn't want to type in a bunch of dates). So it's easy to look at the above table and see that the next tape to use should be 2 because from
2 9
3 10
4 11
1 12
Tape 2 has the oldest date. Now I have created the query using the MAX function to get this result set. I just can't seem to get the minimum of this set. Can anyone PLEASE help? I stumped our SQL guy here with this one and I don't have much hair left to pull out.
Thanks,
Castor
This may sound really wierd, but this is what I need...
I am building a database to keep track of our server backup scheme and which tape was used for each backup. I thought it would be nice for the program to pick which tape should be used on any given day. It should choose the tape that was used least recently. So basically, what I have is this.
A table with TapeId and DateUsed
1 4
2 5
3 6
4 7
1 8
2 9
3 10
4 11
1 12
Now, in real life, the TapeId is not as simple as 1,2,3,4 (also pretend that the second column is a date, I just didn't want to type in a bunch of dates). So it's easy to look at the above table and see that the next tape to use should be 2 because from
2 9
3 10
4 11
1 12
Tape 2 has the oldest date. Now I have created the query using the MAX function to get this result set. I just can't seem to get the minimum of this set. Can anyone PLEASE help? I stumped our SQL guy here with this one and I don't have much hair left to pull out.
Thanks,
Castor