[英]MS Access pull down column via query
I have the following table in MS Access:我在 MS Access 中有下表:
ID | column1 | column2 | column3
---+---------+-------------------+--------------
1 | A | Publishers | Publishers
2 | 01 | Commercial |
3 | 02 | University Press |
4 | B | Place | Place
5 | 01 | United States |
6 | 04 | Western Europe |
7 | 05 | Other |
8 | C | Language | Language
9 | 01 | English |
10 | 02 | French |
I am looking for the following result我正在寻找以下结果
ID |column1 | column2 | column3
---+---------+-------------------+--------------
1 | A | Publishers | Publishers
2 | 01 | Commercial | Publishers
3 | 02 | University Press | Publishers
4 | B | Place | Place
5 | 01 | United States | Place
6 | 04 | Western Europe | Place
7 | 05 | Other | Place
8 | C | Language | Language
9 | 01 | English | Language
10 | 02 | French | Language
So basically pulling down column3 heading.所以基本上拉下第3列标题。 I have tried searching the net and asking other pals with some ms access knowledge.我曾尝试在网上搜索并询问具有一些 ms 访问知识的其他朋友。 But really couldn't find any "pull down" query.但真的找不到任何“下拉”查询。 Copy/paste wouldn't suffice as this will be performed many times in a day and with much larger data set.复制/粘贴是不够的,因为这将在一天内执行多次并且数据集要大得多。 Can this be done without vba (looking to get this done through a query)?这可以在没有 vba 的情况下完成(希望通过查询完成)?
If you have a column that specifies the ordering, you can do this with a correlated subquery:如果您有一列指定了排序,则可以使用相关子查询执行此操作:
select column1, column2,
(select top (1) t2.column3
from t as t2
where t2.id <= t.id and
t2.column3 is not null
order by t2.id desc
) as column3
from t;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.