On Thursday, 29. March 2001 01:38, David Olbersen wrote:
[snip]
>   SELECT
>     building_id,
>     num_buildings,
>     (
>       SELECT count( building_id )
>       FROM   building_portals
>       WHERE  building_id = THIS.building_id
>     )
>   FROM buildings;

Try this query (untested), using table aliases:

SELECT
  b.building_id, b.num_buildings, 
  ( SELECT count( bp.building_id )
      FROM building_portals bp
     WHERE bp.building_id = b.building_id )
  FROM buildings b;

You could also write <table>.<field> instead.

Hope that helps.

Christof
-- 
          gl.aser . software engineering . internet service
       http://gl.aser.de/  . Planckstraße 7 . D-39104 Magdeburg
Tel. +49.391.7 44 77 10 . Fax +49.391.7 44 77 13 . Mobil 0177.77 92 84 3

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly

Reply via email to