Forum: SQL |
Thema:
can anyone help me writing a query? |
Von:
G. Guest (
01.10.2003 17:48) |
I have to write a query to migrate some data and I don't know, how to solve it:
I got a table, having a primary key, a foreign key, a value and a timestamp
PK | FK_ID | VALUE | TIMESTAMP
1 | 1 | 5 | 2003-10-05
2 | 1 | 10 | 2003-09-01
3 | 2 | 15 | 2003-01-15
4 | 2 | 20 | 2003-01-16
there is a second table whose primary key is linked to the foreign key and contains an unset column with values und timestamps as well:
PK | VALUE | TIMESTAMP
1 | - | -
2 | - | -
The value of this second table should be updated with the value from the first table ... as you can see there are 2 possibilities for each row. The row interesting is the one with the later date, so after updating the second table should look like this:
PK | VALUE | TIMESTAMP
1 | 5 | 2003-10-05
2 | 20 | 2003-01-16
Can anyone give me a hint, how I could solve this ?
Betreff |
Von |
Datum |
|
|
G.
Guest
|
11.10.2003 16:26 |
|
|
Antworten
Vorsicht bei der Eingabe: Die Zeichen ' oder -- sind nicht erlaubt!