POSTGRES SQL查询错误无效语法
我有一个类似的问题POSTGRES SQL查询错误无效语法,sql,postgresql,aggregate-functions,Sql,Postgresql,Aggregate Functions,我有一个类似的问题 select to_char( select min(date) from MyTable, 'YYYY-MM-DD' ); 但我总是犯这个错误 ERROR: syntax error at or near "select" LINE 2: select min(date) from MyTable, ^ SQL state: 42601 Character: 18 子查询需要自己的括号: select to_char( (select
select to_char(
select min(date) from MyTable,
'YYYY-MM-DD'
);
但我总是犯这个错误
ERROR: syntax error at or near "select"
LINE 2: select min(date) from MyTable,
^
SQL state: 42601
Character: 18
子查询需要自己的括号:
select to_char( (select min(date) from MyTable), 'YYYY-MM-DD');
更传统的说法是:
select to_char(min(date), 'YYYY-MM-DD')
from MyTable;
不需要子查询。子查询需要自己的括号:
select to_char( (select min(date) from MyTable), 'YYYY-MM-DD');
更传统的说法是:
select to_char(min(date), 'YYYY-MM-DD')
from MyTable;
不需要子查询