firebird数据库sql中子查询问题

来源:百度知道 编辑:UC知道 时间:2024/05/25 00:13:04
在sybase中的句子这样写就可以:
select code as colnum1,
(select riskcode from table2) as colnum2,
(select name from table3) as colnum3,
(select telephone from table4) as colnum4
from table1;

转换到firebird后这样报错,我装的是firebird2.0,支持select * from(select * from XXX)子查询,但不支持上面的那种句子,应该怎么实现呢?请高手帮忙!
哦,发错了,不是上面那个sql,应该是下面这种写法不通
select
(select count(*) from table2) as colnum2,
(select count(*) from table3) as colnum3,
(select count(*) from table4) as colnum4
;

就是要在一个结果集中用三列来输出3个表各自的总记录数,在firebird的sql中应该怎么写?

select riskcode from table2 这样的返回了多行

---firebird我没用过,我想的话你可以这样写

select b.colnum2 from table1 as a left join (select count(*) from table2) as colnum2 as b on 条件;

这样的话每一行后面都会有这个的子行