query (sub) select

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey guys,
I was wondering if this code is possible. I say it is a 4GL code that I am migrating to PHP.

+++++++++++++++++++++++++++++++++++++++++++
$side1Query=ifx_query('select * from line, event'
      .' where line.e_id=event.e_id '
      .' and l_type="'.$s_lt.'" '
      .' and l_status in ("O","C") '
      .' and u_type="P" '
       .' and betno in
         (select min(betno) from line, event
         where line.e_id=event.e_id
         and l_type="'.$s_lt.'") ',$db) or die (ifx_error());
+++++++++++++++++++++++++++++++++++++++++++

I am asking because it would greatly help me since my current method is to select the (min) then use the min in the query.

+++++++++++++++++++++++++++++++++++++++++++
$minS_LT = ifx_query('select min(betno) from line, event'
        .' where line.e_id="'.$ecols['e_id'].'" '
        .' and line.l_status in ("O","C") '
        .' and line.u_type="P" '
        .' and l_type="'.$s_lt.'" ',$db) or die (ifx_error());
$betcols1=ifx_fetch_row($minS_LT);
$min_betno1=min($betcols1);
+++++++++++++++++++++++++++++++++++++++++++
$side1Query=ifx_query('select * from line, event'
      .' where line.e_id=event.e_id '
      .' and l_type="'.$s_lt.'" '
      .' and l_status in ("O","C") '
      .' and u_type="P" '
       .' and betno="'.$min_betno1.'"',$db) or die (ifx_error());
+++++++++++++++++++++++++++++++++++++++++++

Thanks in advance for your assistance.

Regards,

RedHat
http://redhat.opensource.bz
redhat@opensource.bz


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux