Nested select to same tsble

From: "Andy Dunlop" <andy(at)horizon(dot)co(dot)za>
To: <pgsql-php(at)postgresql(dot)org>
Subject: Nested select to same tsble
Date: 2002-11-18 07:06:05
Message-ID: 001801c28ed0$f7153860$7001a8c0@horizon.co.za
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

I hope you won't mind helping me here: (I have searched the Postgres mailing lists but no-one seems to have had this problem) None of the documentation seems to address this:

Is this legal?

$sSql = "select glatype, gla.glacode, gladescrip, gladepr, gll.*
from gll,gla
where gll.glacode = gla.glacode
and gla.glatype = '".strtoupper($glrowresult)."'
and gll.fisyear = $year
order by gll.glacode";
$result1 = pg_exec($conn, $sSql);
for($i=0;$i<pg_numrows($result1);$i++)
{
$glresult = pg_fetch_array($result1,$i);
if($glresult["glatype"]=="FA")
{
$sSql="select * from gll
where gll.glacode = '".strtoupper($glresult["gladepr"])."'
and gll.fisyear = $year";

The second select does not work - it gives no error message either. I wonder if it does not like selecting a seond time from gll while in the loop after the first select. The idea is that some gl accounts need to refer to other ones for a calculation to be done during this report I am trying to do.

Thanks
_________________________________
Andy Dunlop
mailto:andy(at)horizon(dot)co(dot)za

Office: +27 (21) 975 2440
Cell: +27 (82) 770 8749
_________________________________

Responses

Browse pgsql-php by date

  From Date Subject
Next Message Adam Witney 2002-11-18 10:33:44 Re: Transaction including two web page + timer
Previous Message Budi Rianto 2002-11-18 04:48:41 Re: Inquiry From Form [pgsql]