Focus mode

PHP Temel

MIN, MAX, COUNT ve GROUP BY HAVING Kullanımı

PDO SUM MIN MAX COUNT GROUP HAVING

SUM
 $sql = 'SELECT SUM(id) FROM test';

    $query = $db->query($sql);
    if ( $query->rowCount() ){
        print_r($query->fetch(PDO::FETCH_ASSOC));
    }
MIN
 $sql = 'SELECT MIN(id) FROM test';

    $query = $db->query($sql);
    if ( $query->rowCount() ){
        print_r($query->fetch(PDO::FETCH_ASSOC));
    }```
##### MAX

$sql = 'SELECT MAX(id) FROM test';

$query = $db->query($sql);
if ( $query->rowCount() ){
    print_r($query->fetch(PDO::FETCH_ASSOC));
}```
COUNT
  $sql = 'SELECT COUNT(id) FROM test';

    $query = $db->query($sql);
    if ( $query->rowCount() ){
        print_r($query->fetch(PDO::FETCH_ASSOC));
    }
HAVING
$sql = "SELECT COUNT(id) toplam, soyisim FROM test GROUP BY soyisim HAVING toplam > 2";

$query = $db->query($sql);
if ($query->rowCount()) {
    print_r($query->fetch(PDO::FETCH_ASSOC));
}
left-disk

Programs to Accelerate Your Progress in a Software Career

Join our 4-8 month intensive Patika+ bootcamps, start with the fundamentals and gain comprehensive knowledge to kickstart your software career!

right-cube

Comments

You need to enroll in the course to be able to comment!