$sql "select
case
when src = '1' then count(src)
when src = '2' then count(src)
when src = '3' then count(src)
END AS c_src
from user_search
group by src"
$sql = "SELECT src, count(src) as total FROM user_search WHERE dst = 1 GROUP BY src HAVING total > 1 ORDER BY total DESC";
$query = $mysqli->query($sql);
$result = $query->fetch_object();
while($result = $query->fetch_object())
{
echo ''. $result->src ." - ". $result->dst ." = ". $result->total ;
echo "<br>";
ขึ้นเออเร่อเเบบนี้ค่ะ TT'
Notice: Undefined property: stdClass::$dst in /Applications/XAMPP/xamppfiles/htdocs/vacvans/admin_overview.php on line 53
1 - = 5
ลองดูไมรู้ได้ป่าว ยังไม่ได้ test แต่น่าจะประมาณนี้แหละ Code (PHP)
$sql = "select
case
when (src = '2') && (dst = '1') then count(src)
when (src = '4') && (dst = '1') then count(src)
when (src = '1') && (dst = '4') then count(src)
END AS c_src
from user_search
group by src,dst "
$sql = "select
case
when src = '2' then count(src)
when src = '4' then count(src)
when src = '1' then count(src)
END AS c_src
from user_search
group by src,dst "