gpt4 book ai didi

mysql - 无法获取数据库中每个模型名称的最后上传日期数据

转载 作者:行者123 更新时间:2023-11-30 22:52:29 24 4
gpt4 key购买 nike

<分区>

我有一个型号是 dd1。该模型包括几种类型的模型名称。我想通过为每个模型和每个模型名称引用它们的 last_datecreated 来获取模型的最后数据。

    $r= mysql_query("SELECT a.model_no, a.datecreated, a.model_name, a.model
FROM tbl_dsp_mail_inbox a
INNER JOIN (SELECT model_name, MAX(datecreated) AS datecreated
FROM tbl_dsp_mail_inbox a
WHERE status = 'sent'
GROUP BY model_name
) AS b ON a.model_name = b.model_name AND a.datecreated, b.datecreated");
if(mysql_num_rows($r) !== 0){
while ($data = mysql_fetch_object($r)){
$model_n = $data->model_name;
$datecreated = $data->datecreated;
$model_no = $data->model_no;

model  | model_name | model no | last_datecreated |
----------------------------------------------------
dd1 | toyota | 0012-12-B| 25/12/2014
dd1 | kancil | 0013-12-B| 25/12/2014
dd1 | toyota | 0011-12-C| 24/12/2014
dd1 | toyota | 018-13-C | 03/11/2014
dd1 | kancil | 0014-12-E| 01/11/2014

But when I run this code the result is :

model | model_name | model_no | last_datecreated
--------------------------------------------------
dd1 | toyota | 018-13-C | 25/12/2014
dd1 | kancil | 0013-12-B| 25/12/2014

The should be like this (desired output)

model | model_name | model_no | last_datecreated
--------------------------------------------------
dd1 | toyota | 0012-12-B | 25/12/2014
dd1 | kancil | 0013-12-B | 25/12/2014

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com