The problem of repeating the sports date?

:
public function getMemberPhysicalTestDate()
{
    $arr = MemberPhysicalTest::find()
        ->alias("mpt")
        ->joinWith(["member m"],FALSE)
        ->where([
            "m.member_account_id" => $this->accountId,
            "mpt.type" => $this->type,
            "mpt.is_delete" => 0
        ])
        ->select("mpt.create_at")
        ->groupBy(["DATE_FORMAT(from_unixtime(mpt.create_at),"%Y-%m-%d")"])
        ->orderBy("mpt.create_at desc")
        ->asArray()
        ->all();
    return $arr;
}

clipboard.png

clipboard.png
this method doesn"t work very well: only the first item is found, and the second one is not found on June 26th.

Mar.22,2021

public function getMemberPhysicalTestDate()
{
    $arr = MemberPhysicalTest::find()
        ->alias('mpt')
        ->joinWith(['member m'],FALSE)
        ->where([
            'm.member_account_id' => $this->accountId,
            'mpt.type' => $this->type,
            'mpt.is_delete' => 0
        ])
        ->select(["DATE_FORMAT(mpt.create_at,'%Y-%m-%d') as testDate"])
        ->groupBy(["DATE_FORMAT(mpt.create_at,'%Y-%m-%d')"])
        ->orderBy('mpt.create_at desc')
        ->asArray()
        ->all();
    return $arr;
}
groupByfrom_unixtimeok
Menu