On Thu, 30 Aug 2001, Ben-Nes Michael wrote:

> Can I:
>
> select *, sum_rows as ( select count(*) from table2; ) from table1;

I think you need to say:

select *, (select count(*) from table2) as sum_rows from table1;

But this won't be a very interesting query because the sum_rows column
will be the same in every row.

Where subselects get interesting is when you do a correlated subquery like
this:

select *, (select count(*) from table2 where table2.x = table1.y) as
sum_rows from table1;

-- 
Tod McQuillin



---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to