简体   繁体   English

作为关键字 SQL VBA

[英]As keyword SQL VBA

I was looking at SQL statement for an example database which went something like this'我正在查看一个示例数据库的 SQL 语句,它是这样的'

SELECT INDEX, SUM AS Total FROM INVD WHERE INV=[Forms]![ENTRY].[INV]

What does AS mean on the code above?上面代码中的AS是什么意思?

Also is me.Entry same as [Forms]![ENTRY]也是我。Entry 与 [Forms] 相同![ENTRY]

The key word AS indcates, that you want to use an alias for your column name.关键字AS表示您要为列名使用别名。

SELECT Sales FROM Table1 'The column name in the output query will be Sales

SELECT Sales As Money FROM Table1 'The column name in the output query will be Money

To your second question it is not the same.你的第二个问题是不一样的。 If Form1 is the active form and you use me.ID it will be the same like Form1!ID .如果Form1是活动表单并且您使用me.ID它将与Form1!ID相同。 Same when Form2 is the active form and you use me.ID it will be Form2!ID .Form2是活动表单并且您使用me.ID ,它将是Form2!ID So .me refers always to the active form.所以.me总是指主动形式。 But when you use Forms!Form2!ID it will always look for Form2 even when Form1 is the active form.但是当您使用Forms!Form2!ID ,即使Form1是活动表单,它也会始终查找Form2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM