HOW TO RETURN THE FIRST ELEMENT OF A FOR EACH

-1

GOOD AFTERNOON I AM MAKING A SUB-CONSULTATION OF A TABLE IN ORACLE TO BRING THE BENEFICIARIES OF A QUOTE BY MEANS OF A FOREACH I NEED ON THE PART OF THE TABLE TO SHOW ONLY ONE SIDE THE QUOTE, AS IT CAN BE OBSERVED IN THE PICTURE

HOW CAN I CAUSE ONLY KARINA MENDEZ TO SHOW ONE SEE?

    
asked by Paul Valencia 16.09.2017 в 19:08
source

2 answers

0

YOU COULD USE EXPRESSION DISTINCT IN THE CONSULTATION, IN THE BD.

SELECT DISTINCT expressions FROM tables [WHERE conditions];

    
answered by 16.09.2017 в 19:32
0

Create a variable booleana out of foreach , and within foreach evaluate its value with a conditional, if the value is true you add the Beneficiario and if it is false no. The default value of the variable must be true and after the condition you assign it the value false . In that way, the condition of the conditional will only be met in the first iteration of the cycle.

$unaVez = true;

{foreach from=$respuesta key=key item=item}

    // ...
    if ($unaVez) {
        <tr> 
            <td><h1> Beneficiarios </h1></td> 
        </tr> 
    }

    $unaVez = false;
    
answered by 16.09.2017 в 19:51