Skip to Content
Jun 11 at 03:56 AM

How to use 'for all entries' and 'into corresponding' and 'up to 1 row' together in SQL


I have an internal table A with fields name and price and DB table B with fields name,price,date. Now itab A already has name, and I want to for each name in A, query latest price in B and filled into corresponding field of A.

So I wrote

select price from B for all entries in A  where name = A-name order by date descending into corresponding field of table A up to 1 rows.

But it not work, The error said date is not a valid name. But I'm sure B has this date field. So what's the correct way to write it?Thx.