Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Jorge Alcalá
Added: Oct 8, 2018 12:55 PM
Views: 1
Tags: t_query
  1.         $consulta = 'SELECT MAX(cladocumento) AS max '
  2.                 . 'FROM empleadosdocumentos '
  3.                 . 'WHERE clacliente = ' . $cliente
  4.                 . ' GROUP BY claempleado, clatipodocumento';
  5.         $sentencia = $conexion->prepareStatement($consulta);
  6.         $resultset = $sentencia->executeQuery();
  7.        
  8.         $in = 'cladocumento in (-1';
  9.         while( $resultset->next() ){
  10.             $in .= ',' .$resultset->getInt('max');
  11.         }
  12.         $in .= ')';