如何将 asterix 语法与表缩写结合起来
是否可以将 * 语法与表缩写结合起来?
我想做类似的事情:
"SELECT subfunds.* FROM subfunds S" +
" INNER JOIN funds F ON S.id_fund = F.id" +
" WHERE F.fund_short IN('" + stSQLFundList + "')"
上面的代码出现语法错误
“对表“子基金”的 FROM 子句条目的引用无效。
我已经发现,如果我这样做
"SELECT * FROM subfunds S" +
" INNER JOIN funds F ON S.id_fund = F.id" +
" WHERE F.fund_short IN('" + stSQLFundList + "')"
,那么我会从两个表中获取所有字段,而不是仅从子基金表中获取所有字段。
那么我如何从第一个表中获取所有字段(以及我的答案集中没有其他表的字段,同时还能够使用单字母表缩写?
Is it possible to combine * syntax with table abbreviations?
I want to do something like:
"SELECT subfunds.* FROM subfunds S" +
" INNER JOIN funds F ON S.id_fund = F.id" +
" WHERE F.fund_short IN('" + stSQLFundList + "')"
The above code gets a syntax error
"invalid reference to FROM-clause entry for table "subfunds".
I already found that if I do
"SELECT * FROM subfunds S" +
" INNER JOIN funds F ON S.id_fund = F.id" +
" WHERE F.fund_short IN('" + stSQLFundList + "')"
then I get all fields from both tables rather than from the subfunds table only.
So how do I get all fields from the first table (and none of the other tables' fields) in my answer set while also being able to use the single-letter table abbreviations?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将您的代码更改为此,您将获得子基金的所有字段。
如果您使用别名,那么您希望通过别名来引用该表。
Change your code to this and you will get all fields from subfunds.
If you are using an alias, then you want to reference that table by it's alias.