PostgreSQL 查询
我有一个包含一列 (t1date) 的表,如下所示:
Table1
t1date
----------
2011-05-24
还有一个采用一个参数 dfunction(fdate)
的函数。我想将 t1date 的值传递给函数。类似于:
SELECT *
FROM dfunction(SELECT t1date
FROM Table1
ORDER BY t1date
LIMIT 1)
这相当于
SELECT *
FROM dfunction('2011-05-24')
我不想为此编写另一个函数。我正在寻找的是使用 select 语句。是否可以?如果是这样怎么办。
I have a table with one column (t1date) as:
Table1
t1date
----------
2011-05-24
There is also a function which takes one parameter dfunction(fdate)
. I want to pass the value of the t1date
to the function. Something like:
SELECT *
FROM dfunction(SELECT t1date
FROM Table1
ORDER BY t1date
LIMIT 1)
which is equivalent to
SELECT *
FROM dfunction('2011-05-24')
I don't want to write another function for this. What I'm looking for is to use the select statement. Is it possible? If so how.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
据我了解,子查询用作标量表达式时,应括在括号中。那么,这个怎么样:
I understand, a subquery, when used as a scalar expression, should be enclosed in parentheses. So, how about this:
我很难准确理解你想要什么。我有几个选择,如果这些都不是您想要的,也许您可以解释更多?
I'm having difficulty understanding exactly what you want. I have a few options, perhaps you can explain more if neither of these are what you want?